Version 1
[yaffs-website] / web / modules / contrib / diff / src / Routing / RouteSubscriber.php
diff --git a/web/modules/contrib/diff/src/Routing/RouteSubscriber.php b/web/modules/contrib/diff/src/Routing/RouteSubscriber.php
new file mode 100755 (executable)
index 0000000..16e6287
--- /dev/null
@@ -0,0 +1,29 @@
+<?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',
+        )
+      );
+    }
+  }
+
+}