function UrlGenerator::getRoute
Same name in other branches
- 9 core/lib/Drupal/Core/Routing/UrlGenerator.php \Drupal\Core\Routing\UrlGenerator::getRoute()
- 8.9.x core/lib/Drupal/Core/Routing/UrlGenerator.php \Drupal\Core\Routing\UrlGenerator::getRoute()
- 10 core/lib/Drupal/Core/Routing/UrlGenerator.php \Drupal\Core\Routing\UrlGenerator::getRoute()
Find the route using the provided route name.
@internal
Parameters
string $name: The route name.
Return value
\Symfony\Component\Routing\Route The found route.
Throws
\Symfony\Component\Routing\Exception\RouteNotFoundException Thrown if there is no route with that name in this repository.
See also
\Drupal\Core\Routing\RouteProviderInterface
2 calls to UrlGenerator::getRoute()
- UrlGenerator::generateFromRoute in core/
lib/ Drupal/ Core/ Routing/ UrlGenerator.php - Generates a URL or path for a specific route based on the given parameters.
- UrlGenerator::getPathFromRoute in core/
lib/ Drupal/ Core/ Routing/ UrlGenerator.php - Gets the internal path (system path) for a route.
1 method overrides UrlGenerator::getRoute()
- NullGenerator::getRoute in core/
lib/ Drupal/ Core/ Routing/ NullGenerator.php - Methods generate(), generateFromRoute() and getPathFromRoute() all call this protected method.
File
-
core/
lib/ Drupal/ Core/ Routing/ UrlGenerator.php, line 427
Class
- UrlGenerator
- Generates URLs from route names and parameters.
Namespace
Drupal\Core\RoutingCode
protected function getRoute(string $name) {
$route = clone $this->provider
->getRouteByName($name);
return $route;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.