function EntityListBuilder::buildOperations

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/Entity/EntityListBuilder.php \Drupal\Core\Entity\EntityListBuilder::buildOperations()
  2. 10 core/lib/Drupal/Core/Entity/EntityListBuilder.php \Drupal\Core\Entity\EntityListBuilder::buildOperations()
  3. 9 core/lib/Drupal/Core/Entity/EntityListBuilder.php \Drupal\Core\Entity\EntityListBuilder::buildOperations()
  4. 8.9.x core/lib/Drupal/Core/Entity/EntityListBuilder.php \Drupal\Core\Entity\EntityListBuilder::buildOperations()

Builds a renderable list of operation links for the entity.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity on which the linked operations will be performed.

Return value

array A renderable array of operation links.

See also

\Drupal\Core\Entity\EntityListBuilder::buildRow()

2 calls to EntityListBuilder::buildOperations()
ConfigTranslationBlockListBuilder::buildRow in core/modules/config_translation/src/Controller/ConfigTranslationBlockListBuilder.php
Builds a row for an entity in the entity listing.
NodeListBuilder::buildRow in core/modules/node/src/NodeListBuilder.php
Builds a row for an entity in the entity listing.

File

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

Class

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

Namespace

Drupal\Core\Entity

Code

public function buildOperations(EntityInterface $entity) {
  $cacheability = new CacheableMetadata();
  $build = [
    '#type' => 'operations',
    '#links' => $this->getOperations($entity, $cacheability),
    // Allow links to use modals.
'#attached' => [
      'library' => [
        'core/drupal.dialog.ajax',
      ],
    ],
  ];
  $cacheability->applyTo($build);
  return $build;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.