You are here

protected function DiffLayoutBase::buildRevisionLink in Diff 8

Build the revision link for a revision.

Parameters

\Drupal\Core\Entity\ContentEntityInterface $revision: A revision where to add a link.

Return value

\Drupal\Core\Link Header link for a revision in the table.

2 calls to DiffLayoutBase::buildRevisionLink()
SplitFieldsDiffLayout::buildTableHeader in src/Plugin/diff/Layout/SplitFieldsDiffLayout.php
Build the header for the diff table.
UnifiedFieldsDiffLayout::buildTableHeader in src/Plugin/diff/Layout/UnifiedFieldsDiffLayout.php
Build the header for the diff table.

File

src/DiffLayoutBase.php, line 108

Class

DiffLayoutBase
Base class for diff layout plugins.

Namespace

Drupal\diff

Code

protected function buildRevisionLink(ContentEntityInterface $revision) {
  if ($revision instanceof RevisionLogInterface) {
    $revision_date = $this->date
      ->format($revision
      ->getRevisionCreationTime(), 'short');
    $revision_link = Link::fromTextAndUrl($revision_date, $revision
      ->toUrl('revision'))
      ->toString();
  }
  else {
    $revision_link = Link::fromTextAndUrl($revision
      ->label(), $revision
      ->toUrl('revision'))
      ->toString();
  }
  return $revision_link;
}