/** * {@inheritdoc} */ public function buildOperations(EntityInterface $entity) { $build = parent::buildOperations($entity); $build['#links']['clone'] = array('title' => $this->t('Clone'), 'url' => Url::fromRoute('entity.uc_tax_rate.clone', ['uc_tax_rate' => $entity->id()]), 'weight' => 10); uasort($build['#links'], 'Drupal\\Component\\Utility\\SortArray::sortByWeightElement'); return $build; }
public function buildOperations(CssInjectorInterface $entity) { $operations = parent::buildOperations($entity); // todo: enable/disable links callbacks. // if (!$entity->isEnabled()) { // $url = Url::fromRoute('entity.css_injector.enable_form', array('css_injector' => $entity->id)); // $operations['#links']['enable'] = [ // 'title' => t('Enable'), // 'url' => $url, // 'weight' => -10, // ]; // } // else { // $url = Url::fromRoute('entity.css_injector.enable_form', array('css_injector' => $entity->id)); // $operations['#links']['disable'] = [ // 'title' => t('Disable'), // 'url' => $url, // 'weight' => -10, // ]; // } return $operations; }