function RouteSubscriber::alterRoutes

Same name in other branches
  1. 5.x src/Routing/RouteSubscriber.php \Drupal\devel\Routing\RouteSubscriber::alterRoutes()

Overrides RouteSubscriberBase::alterRoutes

File

src/Routing/RouteSubscriber.php, line 51

Class

RouteSubscriber
Subscriber for Devel routes.

Namespace

Drupal\devel\Routing

Code

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);
        }
    }
}