function RouteSubscriber::getEntityRenderRoute
Same name in other branches
- 4.x src/Routing/RouteSubscriber.php \Drupal\devel\Routing\RouteSubscriber::getEntityRenderRoute()
- 5.x src/Routing/RouteSubscriber.php \Drupal\devel\Routing\RouteSubscriber::getEntityRenderRoute()
Gets the entity render 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::getEntityRenderRoute()
- RouteSubscriber::alterRoutes in src/
Routing/ RouteSubscriber.php
File
-
src/
Routing/ RouteSubscriber.php, line 94
Class
- RouteSubscriber
- Subscriber for Devel routes.
Namespace
Drupal\devel\RoutingCode
protected function getEntityRenderRoute(EntityTypeInterface $entity_type) {
if ($devel_render = $entity_type->getLinkTemplate('devel-render')) {
$entity_type_id = $entity_type->id();
$route = new Route($devel_render);
$route->addDefaults([
'_controller' => '\\Drupal\\devel\\Controller\\EntityDebugController::entityRender',
'_title' => 'Devel Render',
])
->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;
}
}