2

I would like to make a small change in the admin/structure/taxonomy/ page.

I need to add one more operation to the edit button on the page.

Its the template_preprocess_links() function I need to alter I believe. I have created a sub theme of the admin theme (Seven). Set it default admin theme. Created mytheme_preprocess_links() function but it does not run.

Any ideas?

| improve this question | | | | |
2

To add/alter entity operations you can use hook_entity_operation_alter:

function hook_entity_operation_alter(array &$operations, \Drupal\Core\Entity\EntityInterface $entity) {

  if ($entity instanceof \Drupal\taxonomy\TermInterface) {
    $operations['foo_operation'] = [
      'title' => 'Foo',
      'url' => \Drupal\Core\Url::fromRoute('bar', ['taxonomy_term' => $entity->id()]),
      'weight' => 10,
    ];
  }
}
| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.