function ConfigEntityListBuilder::getDefaultOperations

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/Entity/ConfigEntityListBuilder.php \Drupal\Core\Config\Entity\ConfigEntityListBuilder::getDefaultOperations()
  2. 10 core/lib/Drupal/Core/Config/Entity/ConfigEntityListBuilder.php \Drupal\Core\Config\Entity\ConfigEntityListBuilder::getDefaultOperations()
  3. 11.x core/lib/Drupal/Core/Config/Entity/ConfigEntityListBuilder.php \Drupal\Core\Config\Entity\ConfigEntityListBuilder::getDefaultOperations()

Overrides EntityListBuilder::getDefaultOperations

15 calls to ConfigEntityListBuilder::getDefaultOperations()
ActionListBuilder::getDefaultOperations in core/modules/action/src/ActionListBuilder.php
Gets this list's default operations.
BlockContentTypeListBuilder::getDefaultOperations in core/modules/block_content/src/BlockContentTypeListBuilder.php
Gets this list's default operations.
BlockListBuilder::getDefaultOperations in core/modules/block/src/BlockListBuilder.php
Gets this list's default operations.
CommentTypeListBuilder::getDefaultOperations in core/modules/comment/src/CommentTypeListBuilder.php
Gets this list's default operations.
FieldConfigListBuilder::getDefaultOperations in core/modules/field_ui/src/FieldConfigListBuilder.php
Gets this list's default operations.

... See full list

15 methods override ConfigEntityListBuilder::getDefaultOperations()
ActionListBuilder::getDefaultOperations in core/modules/action/src/ActionListBuilder.php
Gets this list's default operations.
BlockContentTypeListBuilder::getDefaultOperations in core/modules/block_content/src/BlockContentTypeListBuilder.php
Gets this list's default operations.
BlockListBuilder::getDefaultOperations in core/modules/block/src/BlockListBuilder.php
Gets this list's default operations.
CommentTypeListBuilder::getDefaultOperations in core/modules/comment/src/CommentTypeListBuilder.php
Gets this list's default operations.
FieldConfigListBuilder::getDefaultOperations in core/modules/field_ui/src/FieldConfigListBuilder.php
Gets this list's default operations.

... See full list

File

core/lib/Drupal/Core/Config/Entity/ConfigEntityListBuilder.php, line 31

Class

ConfigEntityListBuilder
Defines the default class to build a listing of configuration entities.

Namespace

Drupal\Core\Config\Entity

Code

public function getDefaultOperations(EntityInterface $entity) {
    
    /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $entity */
    $operations = parent::getDefaultOperations($entity);
    if ($this->entityType
        ->hasKey('status')) {
        if (!$entity->status() && $entity->hasLinkTemplate('enable')) {
            $operations['enable'] = [
                'title' => t('Enable'),
                'weight' => -10,
                'url' => $this->ensureDestination($entity->toUrl('enable')),
            ];
        }
        elseif ($entity->hasLinkTemplate('disable')) {
            $operations['disable'] = [
                'title' => t('Disable'),
                'weight' => 40,
                'url' => $this->ensureDestination($entity->toUrl('disable')),
            ];
        }
    }
    return $operations;
}

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