ConfigEntityListBuilder.php in Drupal 10
File
core/lib/Drupal/Core/Config/Entity/ConfigEntityListBuilder.php
View source
<?php
namespace Drupal\Core\Config\Entity;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Entity\EntityListBuilder;
class ConfigEntityListBuilder extends EntityListBuilder {
public function load() {
$entity_ids = $this
->getEntityIds();
$entities = $this->storage
->loadMultipleOverrideFree($entity_ids);
uasort($entities, [
$this->entityType
->getClass(),
'sort',
]);
return $entities;
}
public function getDefaultOperations(EntityInterface $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;
}
}