Overrides \Drupal\Core\Entity\EntityListController::getOperations();
Overrides EntityListController::getOperations
public function getOperations(EntityInterface $entity) {
$operations = parent::getOperations($entity);
$uri = $entity
->uri();
if (isset($this->entityInfo['entity_keys']['status'])) {
if (!$entity
->status()) {
$operations['enable'] = array(
'title' => t('Enable'),
'href' => $uri['path'] . '/enable',
'options' => $uri['options'],
'weight' => -10,
);
}
else {
$operations['disable'] = array(
'title' => t('Disable'),
'href' => $uri['path'] . '/disable',
'options' => $uri['options'],
'weight' => 20,
);
}
}
return $operations;
}