function EntityListBuilder::buildOperations

Same name in other branches
  1. 9 core/lib/Drupal/Core/Entity/EntityListBuilder.php \Drupal\Core\Entity\EntityListBuilder::buildOperations()
  2. 8.9.x core/lib/Drupal/Core/Entity/EntityListBuilder.php \Drupal\Core\Entity\EntityListBuilder::buildOperations()
  3. 10 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()

5 calls to EntityListBuilder::buildOperations()
BlockListBuilder::buildBlocksForm in core/modules/block/src/BlockListBuilder.php
Builds the main "Blocks" portion of the form.
ConfigTranslationBlockListBuilder::buildRow in core/modules/config_translation/src/Controller/ConfigTranslationBlockListBuilder.php
Builds a row for an entity in the entity listing.
EntityListBuilder::buildRow in core/lib/Drupal/Core/Entity/EntityListBuilder.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.
PathAliasListBuilder::buildRow in core/modules/path/src/PathAliasListBuilder.php
Builds a row for an entity in the entity listing.
2 methods override EntityListBuilder::buildOperations()
TestEntityListBuilder::buildOperations in core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php
Builds a renderable list of operation links for the entity.
TestViewListBuilder::buildOperations in core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php
Builds a renderable list of operation links for the entity.

File

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

Class

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

Namespace

Drupal\Core\Entity

Code

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

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