You are here

protected function AllowedLanguagesRouteSubscriber::alterRoutes in Allowed Languages 2.x

Same name and namespace in other branches
  1. 8 src/Routing/AllowedLanguagesRouteSubscriber.php \Drupal\allowed_languages\Routing\AllowedLanguagesRouteSubscriber::alterRoutes()

Alters existing routes for a specific collection.

Parameters

\Symfony\Component\Routing\RouteCollection $collection: The route collection for adding routes.

Overrides ContentTranslationRouteSubscriber::alterRoutes

File

src/Routing/AllowedLanguagesRouteSubscriber.php, line 17

Class

AllowedLanguagesRouteSubscriber
Subscriber for entity translation routes.

Namespace

Drupal\allowed_languages\Routing

Code

protected function alterRoutes(RouteCollection $collection) {
  foreach ($this->contentTranslationManager
    ->getSupportedEntityTypes() as $entity_type_id => $entity_type) {
    if ($route = $collection
      ->get("entity.{$entity_type_id}.content_translation_overview")) {
      $route
        ->setDefault('_controller', '\\Drupal\\allowed_languages\\Controller\\AllowedLanguagesController::overview');
    }
  }
}