You are here

public function InstallerRouteProviderLazyBuilder::getRouteByName in Drupal 10

Same name and namespace in other branches
  1. 9 core/lib/Drupal/Core/Installer/InstallerRouteProviderLazyBuilder.php \Drupal\Core\Installer\InstallerRouteProviderLazyBuilder::getRouteByName()

Find the route using the provided route name.

Parameters

string $name: The route name to fetch

Return value

\Symfony\Component\Routing\Route The Symfony route object.

Throws

\Symfony\Component\Routing\Exception\RouteNotFoundException If a matching route cannot be found.

Overrides RouteProviderLazyBuilder::getRouteByName

File

core/lib/Drupal/Core/Installer/InstallerRouteProviderLazyBuilder.php, line 16

Class

InstallerRouteProviderLazyBuilder
A Route Provider front-end for use during the installer.

Namespace

Drupal\Core\Installer

Code

public function getRouteByName($name) {
  if ($name === '<none>' || $name === '<front>') {

    // During the installer template_preprocess_page() uses the routing system
    // to determine the front page. At this point building the router for this
    // is unnecessary work.
    return new Route('/');
  }
  return parent::getRouteByName($name);
}