You are here

protected function NullGenerator::getRoute in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Routing/NullGenerator.php \Drupal\Core\Routing\NullGenerator::getRoute()

generate(), generateFromRoute(), and getPathFromRoute() all call this protected method.

Overrides UrlGenerator::getRoute

File

core/lib/Drupal/Core/Routing/NullGenerator.php, line 38
Contains \Drupal\Core\Routing\NullGenerator.

Class

NullGenerator
No-op implementation of a Url Generator, needed for backward compatibility.

Namespace

Drupal\Core\Routing

Code

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();
}