function RouteSubscriber::getPathAliasesRoute

Gets the path aliases route.

Parameters

\Drupal\Core\Entity\EntityTypeInterface $entity_type: The entity type.

Return value

\Symfony\Component\Routing\Route|null The generated route, if available.

1 call to RouteSubscriber::getPathAliasesRoute()
RouteSubscriber::alterRoutes in src/Routing/RouteSubscriber.php
Alters existing routes for a specific collection.

File

src/Routing/RouteSubscriber.php, line 221

Class

RouteSubscriber
Subscriber for Devel routes.

Namespace

Drupal\devel\Routing

Code

protected function getPathAliasesRoute(EntityTypeInterface $entity_type) : ?Route {
    $path_alias_definition = $entity_type->getLinkTemplate('devel-path-alias');
    if ($path_alias_definition === FALSE) {
        return NULL;
    }
    $route = new Route($path_alias_definition);
    $route->addDefaults([
        '_controller' => EntityDebugController::class . '::pathAliases',
        '_title' => 'Path aliases',
    ])
        ->addRequirements([
        '_permission' => 'access devel information',
    ])
        ->setOption('_admin_route', TRUE)
        ->setOption('_devel_entity_type_id', $entity_type->id());
    $link_template = $entity_type->getLinkTemplate('edit-form') ? 'edit-form' : 'canonical';
    $parameters = $this->getRouteParameters($entity_type, $link_template);
    if ($parameters !== []) {
        $route->setOption('parameters', $parameters);
    }
    return $route;
}