function 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 38
Class
- RouteSubscriber
- Subscriber for Devel routes.
Namespace
Drupal\devel\RoutingCode
protected function alterRoutes(RouteCollection $collection) : void {
foreach ($this->entityTypeManager
->getDefinitions() as $entity_type_id => $entity_type) {
$route = $this->getEntityLoadRoute($entity_type);
if ($route instanceof Route) {
$collection->add(sprintf('entity.%s.devel_load', $entity_type_id), $route);
}
$route = $this->getEntityLoadWithReferencesRoute($entity_type);
if ($route instanceof Route) {
$collection->add(sprintf('entity.%s.devel_load_with_references', $entity_type_id), $route);
}
$route = $this->getEntityRenderRoute($entity_type);
if ($route instanceof Route) {
$collection->add(sprintf('entity.%s.devel_render', $entity_type_id), $route);
}
$route = $this->getEntityTypeDefinitionRoute($entity_type);
if ($route instanceof Route) {
$collection->add(sprintf('entity.%s.devel_definition', $entity_type_id), $route);
}
$route = $this->getPathAliasesRoute($entity_type);
if ($route instanceof Route) {
$collection->add(sprintf('entity.%s.devel_path_alias', $entity_type_id), $route);
}
}
}