You are here

public function ConfigEntityListBuilder::getDefaultOperations in Drupal 8

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

Gets this list's default operations.

Parameters

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

Return value

array The array structure is identical to the return value of self::getOperations().

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;
}