function RouteSubscriber::getEntityTypeDefinitionRoute
Same name in other branches
- 8.x-1.x src/Routing/RouteSubscriber.php \Drupal\devel\Routing\RouteSubscriber::getEntityTypeDefinitionRoute()
- 4.x src/Routing/RouteSubscriber.php \Drupal\devel\Routing\RouteSubscriber::getEntityTypeDefinitionRoute()
Gets the entity type definition 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::getEntityTypeDefinitionRoute()
- RouteSubscriber::alterRoutes in src/
Routing/ RouteSubscriber.php - Alters existing routes for a specific collection.
File
-
src/
Routing/ RouteSubscriber.php, line 188
Class
- RouteSubscriber
- Subscriber for Devel routes.
Namespace
Drupal\devel\RoutingCode
protected function getEntityTypeDefinitionRoute(EntityTypeInterface $entity_type) : ?Route {
if ($devel_definition = $entity_type->getLinkTemplate('devel-definition')) {
$route = (new Route($devel_definition))->addDefaults([
'_controller' => EntityDebugController::class . '::entityTypeDefinition',
'_title' => 'Entity type definition',
])
->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';
if (($parameters = $this->getRouteParameters($entity_type, $link_template)) !== []) {
$route->setOption('parameters', $parameters);
}
return $route;
}
return NULL;
}