public ConfigEntityListBuilder::getDefaultOperations(EntityInterface $entity)
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
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'] = 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;
}
Please login to continue.