function NullGenerator::getRoute
Same name in other branches
- 9 core/lib/Drupal/Core/Routing/NullGenerator.php \Drupal\Core\Routing\NullGenerator::getRoute()
- 8.9.x core/lib/Drupal/Core/Routing/NullGenerator.php \Drupal\Core\Routing\NullGenerator::getRoute()
- 10 core/lib/Drupal/Core/Routing/NullGenerator.php \Drupal\Core\Routing\NullGenerator::getRoute()
Methods generate(), generateFromRoute() and getPathFromRoute() all call this protected method.
Overrides UrlGenerator::getRoute
File
-
core/
lib/ Drupal/ Core/ Routing/ NullGenerator.php, line 32
Class
- NullGenerator
- No-op implementation of a URL Generator, needed for backward compatibility.
Namespace
Drupal\Core\RoutingCode
protected function getRoute($name) {
if ($name === '<front>') {
return new Route('/');
}
elseif ($name === '<current>') {
return new Route($this->requestStack
->getCurrentRequest()
->getPathInfo());
}
elseif ($name === '<none>') {
return new Route('');
}
throw new RouteNotFoundException();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.