You are here

public function NodeRevisionController::compareNodeRevisions in Diff 8

Returns a table which shows the differences between two node revisions.

Parameters

\Drupal\node\NodeInterface $node: The node whose revisions are compared.

int $left_revision: Vid of the node revision from the left.

int $right_revision: Vid of the node revision from the right.

string $filter: If $filter == 'raw' raw text is compared (including html tags) If $filter == 'raw-plain' markdown function is applied to the text before comparison.

Return value

array Table showing the diff between the two node revisions.

1 string reference to 'NodeRevisionController::compareNodeRevisions'
diff.routing.yml in ./diff.routing.yml
diff.routing.yml

File

src/Controller/NodeRevisionController.php, line 44

Class

NodeRevisionController
Returns responses for Node Revision routes.

Namespace

Drupal\diff\Controller

Code

public function compareNodeRevisions(NodeInterface $node, $left_revision, $right_revision, $filter) {
  $storage = $this
    ->entityTypeManager()
    ->getStorage('node');
  $route_match = \Drupal::routeMatch();
  $left_revision = $storage
    ->loadRevision($left_revision);
  $right_revision = $storage
    ->loadRevision($right_revision);
  $build = $this
    ->compareEntityRevisions($route_match, $left_revision, $right_revision, $filter);
  return $build;
}