/** * {@inheritdoc} */ public function getOperations(EntityInterface $entity) { $operations = parent::getOperations($entity); // Place the edit operation after the operations added by field_ui.module // which have the weights 15, 20, 25. if (isset($operations['edit'])) { $operations['edit'] = [ 'title' => t('Edit'), 'weight' => 30, 'url' => $entity->urlInfo('edit-form') ]; } if (isset($operations['delete'])) { $operations['delete'] = [ 'title' => t('Delete'), 'weight' => 35, 'url' => $entity->urlInfo('delete-form') ]; } // Sort the operations to normalize link order. uasort($operations, [ 'Drupal\Component\Utility\SortArray', 'sortByWeightElement' ]); return $operations; }
/** * @inheritDoc */ public function getOperations(EntityInterface $entity) { $operations = parent::getOperations($entity); if (!empty($operations['edit'])) { /** @var \Drupal\Core\Url $edit */ $edit = $operations['edit']['url']; $edit->setRouteParameters(['machine_name' => $entity->id(), 'step' => 'general']); } return $operations; }
/** * {@inheritdoc} */ public function getOperations(EntityInterface $entity) { $operations = parent::getOperations($entity); // Global and entity defaults can be reverted but not deleted. if (strpos($entity->id(), '__') === FALSE) { unset($operations['delete']); $operations['revert'] = array('title' => t('Revert'), 'weight' => $operations['edit']['weight'] + 1, 'url' => $entity->urlInfo('revert-form')); } return $operations; }
/** * {@inheritdoc} */ public function getOperations(EntityInterface $entity) { $operations = parent::getOperations($entity); foreach (array_keys($operations) as $operation) { // This is a translation UI for translators. Show the translation // operation only. if (!($operation == 'translate')) { unset($operations[$operation]); } } return $operations; }
/** * {@inheritdoc} */ public function getOperations(EntityInterface $entity) { $operations = parent::getOperations($entity); $operations['delete']['href'] = 'admin/config/domain/alias/delete/' . $entity->id(); return $operations; }
/** * {@inheritdoc} */ public function getOperations(EntityInterface $entity) { $operations = parent::getOperations($entity); if (isset($operations['translate'])) { unset($operations['translate']); } return $operations; }