You are here

public function RouteSubscriber::alterRoutes in Diff 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\diff\Routing

Code

public function alterRoutes(RouteCollection $collection) {

  // Replace the content from node.revision_overview route with content
  // generated by revisionOverview method from NodeRevisionController class.
  $route = $collection
    ->get('entity.node.version_history');
  if ($route) {
    $route
      ->addDefaults(array(
      '_controller' => '\\Drupal\\diff\\Controller\\NodeRevisionController::revisionOverview',
    ));
  }
}