function RouteSubscriber::getEntityLoadRoute

Same name in other branches
  1. 5.x src/Routing/RouteSubscriber.php \Drupal\devel\Routing\RouteSubscriber::getEntityLoadRoute()

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

File

src/Routing/RouteSubscriber.php, line 74

Class

RouteSubscriber
Subscriber for Devel routes.

Namespace

Drupal\devel\Routing

Code

protected function getEntityLoadRoute(EntityTypeInterface $entity_type) {
    if ($devel_load = $entity_type->getLinkTemplate('devel-load')) {
        $route = (new Route($devel_load))->addDefaults([
            '_controller' => '\\Drupal\\devel\\Controller\\EntityDebugController::entityLoad',
            '_title' => 'Devel Load',
        ])
            ->addRequirements([
            '_permission' => 'access devel information',
        ])
            ->setOption('_admin_route', TRUE)
            ->setOption('_devel_entity_type_id', $entity_type->id());
        if ($parameters = $this->getRouteParameters($entity_type, 'edit-form')) {
            $route->setOption('parameters', $parameters);
        }
        return $route;
    }
    return NULL;
}