You are here

protected function RouteSubscriber::alterRoutes in Devel 8.2

Same name and namespace in other branches
  1. 8.3 src/Routing/RouteSubscriber.php \Drupal\devel\Routing\RouteSubscriber::alterRoutes()
  2. 8 src/Routing/RouteSubscriber.php \Drupal\devel\Routing\RouteSubscriber::alterRoutes()
  3. 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\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);
    }
  }
}