You are here

protected function TmgmtConfigRouteSubscriber::alterRoutes in Translation Management Tool 8

Alters existing routes for a specific collection.

Parameters

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

Overrides RouteSubscriberBase::alterRoutes

File

sources/tmgmt_config/src/Routing/TmgmtConfigRouteSubscriber.php, line 17

Class

TmgmtConfigRouteSubscriber
Subscriber to alter entity translation routes.

Namespace

Drupal\tmgmt_config\Routing

Code

protected function alterRoutes(RouteCollection $collection) {

  // Look for routes that use  ContentTranslationController and change it
  // to our subclass.
  foreach ($collection as $route) {
    if ($route
      ->getDefault('_controller') == '\\Drupal\\config_translation\\Controller\\ConfigTranslationController::itemPage') {
      $route
        ->setDefault('_controller', '\\Drupal\\tmgmt_config\\Controller\\ConfigTranslationControllerOverride::itemPage');
    }
  }
}