function RouteSubscriber::getEntityLoadWithReferencesRoute

Gets the entity load 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::getEntityLoadWithReferencesRoute()
RouteSubscriber::alterRoutes in src/Routing/RouteSubscriber.php
Alters existing routes for a specific collection.

File

src/Routing/RouteSubscriber.php, line 122

Class

RouteSubscriber
Subscriber for Devel routes.

Namespace

Drupal\devel\Routing

Code

protected function getEntityLoadWithReferencesRoute(EntityTypeInterface $entity_type) : Route|null {
    $devel_load = $entity_type->getLinkTemplate('devel-load-with-references');
    if ($devel_load === FALSE) {
        return NULL;
    }
    $entity_type_id = $entity_type->id();
    $route = new Route($devel_load);
    $route->addDefaults([
        '_controller' => EntityDebugController::class . '::entityLoadWithReferences',
        '_title' => 'Devel Load (with references)',
    ])
        ->addRequirements([
        '_permission' => 'access devel information',
    ])
        ->setOption('_admin_route', TRUE)
        ->setOption('_devel_entity_type_id', $entity_type_id)
        ->setOption('parameters', [
        $entity_type_id => [
            'type' => 'entity:' . $entity_type_id,
        ],
    ]);
    return $route;
}