public ConfigEntityListBuilder::getDefaultOperations(EntityInterface $entity)
Gets this list's default operations.
\Drupal\Core\Entity\EntityInterface $entity: The entity the operations are for.
array The array structure is identical to the return value of self::getOperations().
Overrides EntityListBuilder::getDefaultOperations
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