You are here

protected function RouteSubscriber::getEntityLoadRoute in Devel 8

Same name and namespace in other branches
  1. 8.3 src/Routing/RouteSubscriber.php \Drupal\devel\Routing\RouteSubscriber::getEntityLoadRoute()
  2. 8.2 src/Routing/RouteSubscriber.php \Drupal\devel\Routing\RouteSubscriber::getEntityLoadRoute()
  3. 4.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 63

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')) {
    $entity_type_id = $entity_type
      ->id();
    $route = new Route($devel_load);
    $route
      ->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)
      ->setOption('parameters', [
      $entity_type_id => [
        'type' => 'entity:' . $entity_type_id,
      ],
    ]);
    return $route;
  }
}