You are here

public function PetDiffRevisionController::comparePetRevisions in Previewable email templates 8.3

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

Parameters

\Drupal\pet\Entity\PetInterface $pet: 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.

File

src/Controller/PetDiffRevisionController.php, line 50

Class

PetDiffRevisionController
Class PetDiffRevisionController.

Namespace

Drupal\pet\Controller

Code

public function comparePetRevisions(PetInterface $pet, $left_revision, $right_revision, $filter) {
  $storage = $this
    ->entityTypeManager()
    ->getStorage('pet');
  $route_match = \Drupal::routeMatch();

  /** @var \Drupal\pet\Entity\PetInterface $left_revision */
  $left_revision = $storage
    ->loadRevision($left_revision);

  /** @var \Drupal\pet\Entity\PetInterface $right_revision */
  $right_revision = $storage
    ->loadRevision($right_revision);
  $build = $this
    ->compareEntityRevisions($route_match, $left_revision, $right_revision, $filter);
  return $build;
}