You are here

public function RouteSubscriber::alterRoutes in Display Suite 8.3

Same name in this branch
  1. 8.3 src/Routing/RouteSubscriber.php \Drupal\ds\Routing\RouteSubscriber::alterRoutes()
  2. 8.3 modules/ds_devel/src/Routing/RouteSubscriber.php \Drupal\ds_devel\Routing\RouteSubscriber::alterRoutes()
  3. 8.3 modules/ds_extras/src/EventSubscriber/RouteSubscriber.php \Drupal\ds_extras\EventSubscriber\RouteSubscriber::alterRoutes()
Same name and namespace in other branches
  1. 8.4 modules/ds_extras/src/EventSubscriber/RouteSubscriber.php \Drupal\ds_extras\EventSubscriber\RouteSubscriber::alterRoutes()
  2. 8.2 modules/ds_extras/src/EventSubscriber/RouteSubscriber.php \Drupal\ds_extras\EventSubscriber\RouteSubscriber::alterRoutes()

Alters the routes.

Parameters

\Drupal\Core\Routing\RouteBuildEvent $event: The event to process.

File

modules/ds_extras/src/EventSubscriber/RouteSubscriber.php, line 28

Class

RouteSubscriber
Alter the node view route.

Namespace

Drupal\ds_extras\EventSubscriber

Code

public function alterRoutes(RouteBuildEvent $event) {
  if (\Drupal::config('ds_extras.settings')
    ->get('override_node_revision')) {
    $route = $event
      ->getRouteCollection()
      ->get('entity.node.revision');
    if (!empty($route)) {
      $route
        ->setDefault('_controller', '\\Drupal\\ds_extras\\Controller\\DsExtrasController::revisionShow');
    }
  }
}