public UrlGeneratorInterface::generateFromRoute($name, $parameters = array(), $options = array(), $collect_bubbleable_metadata = FALSE)
Generates a URL or path for a specific route based on the given parameters.
Parameters that reference placeholders in the route pattern will be substituted for them in the pattern. Extra params are added as query strings to the URL.
@internal Should not be used in user code. Use \Drupal\Core\Url instead.
string|\Symfony\Component\Routing\Route $name: The route name or a route object.
array $parameters: An associative array of parameter names and values.
array $options: (optional) An associative array of additional options, with the following elements:
bool $collect_bubbleable_metadata: (optional) Defaults to FALSE. When TRUE, both the generated URL and its associated bubbleable metadata are returned.
string|\Drupal\Core\GeneratedUrl The generated URL for the given route. When $collect_bubbleable_metadata is TRUE, a GeneratedUrl object is returned, containing the generated URL plus bubbleable metadata.
\Symfony\Component\Routing\Exception\RouteNotFoundException Thrown when the named route does not exist.
\Symfony\Component\Routing\Exception\MissingMandatoryParametersException Thrown when some parameters are missing that are mandatory for the route.
\Symfony\Component\Routing\Exception\InvalidParameterException Thrown when a parameter value for a placeholder is not correct because it does not match the requirement.
public function generateFromRoute($name, $parameters = array(), $options = array(), $collect_bubbleable_metadata = FALSE);
© 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!Routing!UrlGeneratorInterface.php/function/UrlGeneratorInterface::generateFromRoute/8.1.x