You are here

protected function RevisionControllerTrait::getOperationLinks in Entity API 8

Same name and namespace in other branches
  1. 8.0 src/Controller/RevisionControllerTrait.php \Drupal\entity\Controller\RevisionControllerTrait::getOperationLinks()

Get the links of the operations for an entity revision.

Parameters

\Drupal\Core\Entity\EntityInterface $entity_revision: The entity to build the revision links for.

Return value

array The operation links.

1 call to RevisionControllerTrait::getOperationLinks()
RevisionControllerTrait::revisionOverview in src/Controller/RevisionControllerTrait.php
Generates an overview table of older revisions of an entity.

File

src/Controller/RevisionControllerTrait.php, line 180

Class

RevisionControllerTrait
Defines a trait for common revision UI functionality.

Namespace

Drupal\entity\Controller

Code

protected function getOperationLinks(EntityInterface $entity_revision) {
  $links = [];
  if ($this
    ->hasRevertRevisionAccess($entity_revision)) {
    $links['revert'] = $this
      ->buildRevertRevisionLink($entity_revision);
  }
  if ($this
    ->hasDeleteRevisionAccess($entity_revision)) {
    $links['delete'] = $this
      ->buildDeleteRevisionLink($entity_revision);
  }
  return array_filter($links);
}