public Url::toUriString()
Generates a URI string that represents the data in the Url object.
The URI will typically have the scheme of route: even if the object was constructed using an entity: or internal: scheme. A internal: URI that does not match a Drupal route with be returned here with the base: scheme, and external URLs will be returned in their original form.
string A URI representation of the Url object data.
public function toUriString() { if ($this->isRouted()) { $uri = 'route:' . $this->routeName; if ($this->routeParameters) { $uri .= ';' . UrlHelper::buildQuery($this->routeParameters); } } else { $uri = $this->uri; } $query = !empty($this->options['query']) ? ('?' . UrlHelper::buildQuery($this->options['query'])) : ''; $fragment = isset($this->options['fragment']) && strlen($this->options['fragment']) ? '#' . $this->options['fragment'] : ''; return $uri . $query . $fragment; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Url.php/function/Url::toUriString/8.1.x