You are here

protected function TmgmtContentRouteSubscriber::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/content/src/Routing/TmgmtContentRouteSubscriber.php, line 17

Class

TmgmtContentRouteSubscriber
Subscriber to alter entity translation routes.

Namespace

Drupal\tmgmt_content\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\\content_translation\\Controller\\ContentTranslationController::overview') {
      $route
        ->setDefault('_controller', '\\Drupal\\tmgmt_content\\Controller\\ContentTranslationControllerOverride::overview');
    }
  }
}