Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 16 |
ConfigEntityListBuilder | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
42 | |
0.00% |
0 / 16 |
load | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 4 |
|||
getDefaultOperations | |
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 12 |
<?php | |
/** | |
* @file | |
* Contains \Drupal\Core\Config\Entity\ConfigEntityListBuilder. | |
*/ | |
namespace Drupal\Core\Config\Entity; | |
use Drupal\Core\Entity\EntityInterface; | |
use Drupal\Core\Entity\EntityListBuilder; | |
/** | |
* Defines the default class to build a listing of configuration entities. | |
* | |
* @ingroup entity_api | |
*/ | |
class ConfigEntityListBuilder extends EntityListBuilder { | |
/** | |
* {@inheritdoc} | |
*/ | |
public function load() { | |
$entity_ids = $this->getEntityIds(); | |
$entities = $this->storage->loadMultipleOverrideFree($entity_ids); | |
// Sort the entities using the entity class's sort() method. | |
// See \Drupal\Core\Config\Entity\ConfigEntityBase::sort(). | |
uasort($entities, array($this->entityType->getClass(), 'sort')); | |
return $entities; | |
} | |
/** | |
* {@inheritdoc} | |
*/ | |
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'] = array( | |
'title' => t('Enable'), | |
'weight' => -10, | |
'url' => $entity->urlInfo('enable'), | |
); | |
} | |
elseif ($entity->hasLinkTemplate('disable')) { | |
$operations['disable'] = array( | |
'title' => t('Disable'), | |
'weight' => 40, | |
'url' => $entity->urlInfo('disable'), | |
); | |
} | |
} | |
return $operations; | |
} | |
} |