You are here

protected function EntityListBuilder::getDefaultOperations in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Entity/EntityListBuilder.php \Drupal\Core\Entity\EntityListBuilder::getDefaultOperations()

Gets this list's default operations.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity the operations are for.

Return value

array The array structure is identical to the return value of self::getOperations().

4 calls to EntityListBuilder::getDefaultOperations()
BlockContentListBuilder::getDefaultOperations in core/modules/block_content/src/BlockContentListBuilder.php
Gets this list's default operations.
ConfigEntityListBuilder::getDefaultOperations in core/lib/Drupal/Core/Config/Entity/ConfigEntityListBuilder.php
Gets this list's default operations.
EntityListBuilder::getOperations in core/lib/Drupal/Core/Entity/EntityListBuilder.php
Provides an array of information to build a list of operation links.
NodeListBuilder::getDefaultOperations in core/modules/node/src/NodeListBuilder.php
Gets this list's default operations.
3 methods override EntityListBuilder::getDefaultOperations()
BlockContentListBuilder::getDefaultOperations in core/modules/block_content/src/BlockContentListBuilder.php
Gets this list's default operations.
ConfigEntityListBuilder::getDefaultOperations in core/lib/Drupal/Core/Config/Entity/ConfigEntityListBuilder.php
Gets this list's default operations.
NodeListBuilder::getDefaultOperations in core/modules/node/src/NodeListBuilder.php
Gets this list's default operations.

File

core/lib/Drupal/Core/Entity/EntityListBuilder.php, line 145
Contains \Drupal\Core\Entity\EntityListBuilder.

Class

EntityListBuilder
Defines a generic implementation to build a listing of entities.

Namespace

Drupal\Core\Entity

Code

protected function getDefaultOperations(EntityInterface $entity) {
  $operations = array();
  if ($entity
    ->access('update') && $entity
    ->hasLinkTemplate('edit-form')) {
    $operations['edit'] = array(
      'title' => $this
        ->t('Edit'),
      'weight' => 10,
      'url' => $entity
        ->urlInfo('edit-form'),
    );
  }
  if ($entity
    ->access('delete') && $entity
    ->hasLinkTemplate('delete-form')) {
    $operations['delete'] = array(
      'title' => $this
        ->t('Delete'),
      'weight' => 100,
      'url' => $entity
        ->urlInfo('delete-form'),
    );
  }
  return $operations;
}