protected function RouteSubscriber::alterRoutes in Devel 8
Same name and namespace in other branches
- 8.3 src/Routing/RouteSubscriber.php \Drupal\devel\Routing\RouteSubscriber::alterRoutes()
- 8.2 src/Routing/RouteSubscriber.php \Drupal\devel\Routing\RouteSubscriber::alterRoutes()
- 4.x src/Routing/RouteSubscriber.php \Drupal\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
- src/
Routing/ RouteSubscriber.php, line 40
Class
- RouteSubscriber
- Subscriber for Devel routes.
Namespace
Drupal\devel\RoutingCode
protected function alterRoutes(RouteCollection $collection) {
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $entity_type) {
if ($route = $this
->getEntityLoadRoute($entity_type)) {
$collection
->add("entity.{$entity_type_id}.devel_load", $route);
}
if ($route = $this
->getEntityRenderRoute($entity_type)) {
$collection
->add("entity.{$entity_type_id}.devel_render", $route);
}
if ($route = $this
->getEntityTypeDefinitionRoute($entity_type)) {
$collection
->add("entity.{$entity_type_id}.devel_definition", $route);
}
}
}