3 namespace Drupal\Core\Config\Entity;
5 use Drupal\Core\Entity\EntityInterface;
6 use Drupal\Core\Entity\EntityListBuilder;
9 * Defines the default class to build a listing of configuration entities.
13 class ConfigEntityListBuilder extends EntityListBuilder {
18 public function load() {
19 $entity_ids = $this->getEntityIds();
20 $entities = $this->storage->loadMultipleOverrideFree($entity_ids);
22 // Sort the entities using the entity class's sort() method.
23 // See \Drupal\Core\Config\Entity\ConfigEntityBase::sort().
24 uasort($entities, [$this->entityType->getClass(), 'sort']);
31 public function getDefaultOperations(EntityInterface $entity) {
32 /** @var \Drupal\Core\Config\Entity\ConfigEntityInterface $entity */
33 $operations = parent::getDefaultOperations($entity);
35 if ($this->entityType->hasKey('status')) {
36 if (!$entity->status() && $entity->hasLinkTemplate('enable')) {
37 $operations['enable'] = [
38 'title' => t('Enable'),
40 'url' => $this->ensureDestination($entity->toUrl('enable')),
43 elseif ($entity->hasLinkTemplate('disable')) {
44 $operations['disable'] = [
45 'title' => t('Disable'),
47 'url' => $this->ensureDestination($entity->toUrl('disable')),