You are here

RouteSubscriber.php in Diff 8

File

src/Routing/RouteSubscriber.php
View source
<?php

namespace Drupal\diff\Routing;

use Drupal\Core\Routing\RouteSubscriberBase;
use Symfony\Component\Routing\RouteCollection;

/**
 * Listens to the dynamic route events.
 */
class RouteSubscriber extends RouteSubscriberBase {

  /**
   * {@inheritdoc}
   */
  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',
      ));
    }
  }

}

Classes

Namesort descending Description
RouteSubscriber Listens to the dynamic route events.