3 namespace Drupal\diff\Controller;
5 use Drupal\node\NodeInterface;
8 * Returns responses for Node Revision routes.
10 class NodeRevisionController extends PluginRevisionController {
13 * Returns a form for revision overview page.
15 * @todo This might be changed to a view when the issue at this link is
16 * resolved: https://drupal.org/node/1863906
18 * @param \Drupal\node\NodeInterface $node
19 * The node whose revisions are inspected.
22 * Render array containing the revisions table for $node.
24 public function revisionOverview(NodeInterface $node) {
25 return $this->formBuilder()->getForm('Drupal\diff\Form\RevisionOverviewForm', $node);
29 * Returns a table which shows the differences between two node revisions.
31 * @param \Drupal\node\NodeInterface $node
32 * The node whose revisions are compared.
33 * @param int $left_revision
34 * Vid of the node revision from the left.
35 * @param int $right_revision
36 * Vid of the node revision from the right.
37 * @param string $filter
38 * If $filter == 'raw' raw text is compared (including html tags)
39 * If $filter == 'raw-plain' markdown function is applied to the text before comparison.
42 * Table showing the diff between the two node revisions.
44 public function compareNodeRevisions(NodeInterface $node, $left_revision, $right_revision, $filter) {
45 $storage = $this->entityTypeManager()->getStorage('node');
46 $route_match = \Drupal::routeMatch();
47 $left_revision = $storage->loadRevision($left_revision);
48 $right_revision = $storage->loadRevision($right_revision);
49 $build = $this->compareEntityRevisions($route_match, $left_revision, $right_revision, $filter);