You are here

public function EntityListBuilder::getOperations in Drupal 8

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

Provides an array of information to build a list of operation links.

Parameters

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

Return value

array An associative array of operation link data for this list, keyed by operation name, containing the following key-value pairs:

  • title: The localized title of the operation.
  • url: An instance of \Drupal\Core\Url for the operation URL.
  • weight: The weight of this operation.

Overrides EntityListBuilderInterface::getOperations

3 calls to EntityListBuilder::getOperations()
ConfigTranslationEntityListBuilder::getOperations in core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php
Provides an array of information to build a list of operation links.
EntityListBuilder::buildOperations in core/lib/Drupal/Core/Entity/EntityListBuilder.php
Builds a renderable list of operation links for the entity.
UserListBuilder::getOperations in core/modules/user/src/UserListBuilder.php
Provides an array of information to build a list of operation links.
2 methods override EntityListBuilder::getOperations()
ConfigTranslationEntityListBuilder::getOperations in core/modules/config_translation/src/Controller/ConfigTranslationEntityListBuilder.php
Provides an array of information to build a list of operation links.
UserListBuilder::getOperations in core/modules/user/src/UserListBuilder.php
Provides an array of information to build a list of operation links.

File

core/lib/Drupal/Core/Entity/EntityListBuilder.php, line 127

Class

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

Namespace

Drupal\Core\Entity

Code

public function getOperations(EntityInterface $entity) {
  $operations = $this
    ->getDefaultOperations($entity);
  $operations += $this
    ->moduleHandler()
    ->invokeAll('entity_operation', [
    $entity,
  ]);
  $this->moduleHandler
    ->alter('entity_operation', $operations, $entity);
  uasort($operations, '\\Drupal\\Component\\Utility\\SortArray::sortByWeightElement');
  return $operations;
}