function EntityListBuilder::getOperations
Same name and namespace in other branches
- 11.x core/lib/Drupal/Core/Entity/EntityListBuilder.php \Drupal\Core\Entity\EntityListBuilder::getOperations()
- 10 core/lib/Drupal/Core/Entity/EntityListBuilder.php \Drupal\Core\Entity\EntityListBuilder::getOperations()
- 9 core/lib/Drupal/Core/Entity/EntityListBuilder.php \Drupal\Core\Entity\EntityListBuilder::getOperations()
- 8.9.x 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.
\Drupal\Core\Cache\CacheableMetadata|null $cacheability: The cacheable metadata to add to if your operations vary by or depend on something.
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
4 calls to EntityListBuilder::getOperations()
- BlockContentListBuilder::getOperations in core/
modules/ block_content/ src/ BlockContentListBuilder.php - EntityDisplayModeListBuilder::getOperations in core/
modules/ field_ui/ src/ EntityDisplayModeListBuilder.php - 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
4 methods override EntityListBuilder::getOperations()
- BlockContentListBuilder::getOperations in core/
modules/ block_content/ src/ BlockContentListBuilder.php - ConfigTranslationEntityListBuilder::getOperations in core/
modules/ config_translation/ src/ Controller/ ConfigTranslationEntityListBuilder.php - Provides an array of information to build a list of operation links.
- EntityDisplayModeListBuilder::getOperations in core/
modules/ field_ui/ src/ EntityDisplayModeListBuilder.php - UserListBuilder::getOperations in core/
modules/ user/ src/ UserListBuilder.php
File
-
core/
lib/ Drupal/ Core/ Entity/ EntityListBuilder.php, line 132
Class
- EntityListBuilder
- Defines a generic implementation to build a listing of entities.
Namespace
Drupal\Core\EntityCode
public function getOperations(EntityInterface $entity, ?CacheableMetadata $cacheability = NULL) {
$cacheability ??= new CacheableMetadata();
$operations = $this->getDefaultOperations($entity, $cacheability);
$operations += $this->moduleHandler()
->invokeAll('entity_operation', [
$entity,
$cacheability,
]);
$this->moduleHandler
->alter('entity_operation', $operations, $entity, $cacheability);
uasort($operations, '\\Drupal\\Component\\Utility\\SortArray::sortByWeightElement');
return $operations;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.