function RouteSubscriber::alterRoutes

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

Overrides RouteSubscriberBase::alterRoutes

File

src/Routing/RouteSubscriber.php, line 48

Class

RouteSubscriber
Subscriber for Devel routes.

Namespace

Drupal\devel\Routing

Code

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