protected static Url::fromRouteUri(array $uri_parts, array $options, $uri)
Creates a new Url object for 'route:' URIs.
array $uri_parts: Parts from an URI of the form route:{route_name};{route_parameters} as from parse_url(), where the path is the route name optionally followed by a ";" followed by route parameters in key=value format with & separators.
array $options: An array of options, see \Drupal\Core\Url::fromUri() for details.
string $uri: The original passed in URI.
\Drupal\Core\Url A new Url object for a 'route:' URI.
\InvalidArgumentException Thrown when the route URI does not have a route name.
protected static function fromRouteUri(array $uri_parts, array $options, $uri) { $route_parts = explode(';', $uri_parts['path'], 2); $route_name = $route_parts[0]; if ($route_name === '') { throw new \InvalidArgumentException("The route URI '$uri' is invalid. You must have a route name in the URI. e.g., route:system.admin"); } $route_parameters = []; if (!empty($route_parts[1])) { parse_str($route_parts[1], $route_parameters); } return new static($route_name, $route_parameters, $options); }
© 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::fromRouteUri/8.1.x