On this page
public function ConfigEntityListBuilder::getDefaultOperations
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\EntityCode
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;
}
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Config!Entity!ConfigEntityListBuilder.php/function/ConfigEntityListBuilder::getDefaultOperations/8.1.x