You are here

protected function RouteSubscriber::alterRoutes in Language Hierarchy 8

Same name and namespace in other branches
  1. 2.x src/Routing/RouteSubscriber.php \Drupal\language_hierarchy\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 35

Class

RouteSubscriber
Listens to the dynamic route events.

Namespace

Drupal\language_hierarchy\Routing

Code

protected function alterRoutes(RouteCollection $collection) {
  $mappers = $this->mapperManager
    ->getMappers($collection);
  foreach ($mappers as $mapper) {
    $route = $collection
      ->get($mapper
      ->getOverviewRouteName());
    if ($route
      ->getDefault('_controller') === '\\Drupal\\config_translation\\Controller\\ConfigTranslationController::itemPage') {
      $route
        ->setDefault('_controller', '\\Drupal\\language_hierarchy\\Controller\\ConfigTranslationController::itemPage');
    }
  }
}