You are here

public function RouteSubscriber::alterRoutes in Node Accessibility 8

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 16

Class

RouteSubscriber
Listens to the dynamic route events.

Namespace

Drupal\node_accessibility\Routing

Code

public function alterRoutes(RouteCollection $collection) {
  $modify_route = \Drupal::config('node_accessibility.settings')
    ->get('alter_revision_menu');
  if ($modify_route == 1) {
    $route = $collection
      ->get('entity.node.version_history');
    if ($route) {
      $route
        ->addDefaults(array(
        '_controller' => '\\Drupal\\node_accessibility\\Controller\\NodeAccessibilityController::revisionOverview',
      ));
    }
  }
}