protected function RouteSubscriber::alterRoutes in Display Suite 8.2
Same name in this branch
- 8.2 src/Routing/RouteSubscriber.php \Drupal\ds\Routing\RouteSubscriber::alterRoutes()
- 8.2 modules/ds_devel/src/Routing/RouteSubscriber.php \Drupal\ds_devel\Routing\RouteSubscriber::alterRoutes()
- 8.2 modules/ds_extras/src/EventSubscriber/RouteSubscriber.php \Drupal\ds_extras\EventSubscriber\RouteSubscriber::alterRoutes()
Same name and namespace in other branches
- 8.4 modules/ds_devel/src/Routing/RouteSubscriber.php \Drupal\ds_devel\Routing\RouteSubscriber::alterRoutes()
- 8.3 modules/ds_devel/src/Routing/RouteSubscriber.php \Drupal\ds_devel\Routing\RouteSubscriber::alterRoutes()
Alters existing routes for a specific collection.
Parameters
\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.
Overrides RouteSubscriberBase::alterRoutes
File
- modules/
ds_devel/ src/ Routing/ RouteSubscriber.php, line 36
Class
- RouteSubscriber
- Subscriber for Devel routes.
Namespace
Drupal\ds_devel\RoutingCode
protected function alterRoutes(RouteCollection $collection) {
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $entity_type) {
if ($entity_type
->hasLinkTemplate('devel-markup')) {
$options = array(
'_admin_route' => TRUE,
'_devel_entity_type_id' => $entity_type_id,
'parameters' => array(
$entity_type_id => array(
'type' => 'entity:' . $entity_type_id,
),
),
);
if ($devel_render = $entity_type
->getLinkTemplate('devel-markup')) {
$route = new Route($devel_render, array(
'_controller' => '\\Drupal\\ds_devel\\Controller\\DsDevelController::entityMarkup',
'_title' => 'Devel Render',
), array(
'_permission' => 'access devel information',
), $options);
$collection
->add("entity.{$entity_type_id}.devel_markup", $route);
}
}
}
}