function TaxonomyHooks::entityOperation
Implements hook_entity_operation().
File
-
core/
modules/ taxonomy/ src/ Hook/ TaxonomyHooks.php, line 99
Class
- TaxonomyHooks
- Hook implementations for taxonomy.
Namespace
Drupal\taxonomy\HookCode
public function entityOperation(EntityInterface $term) {
$operations = [];
if ($term instanceof Term && $term->access('create')) {
$operations['add-child'] = [
'title' => t('Add child'),
'weight' => 10,
'url' => Url::fromRoute('entity.taxonomy_term.add_form', [
'taxonomy_vocabulary' => $term->bundle(),
], [
'query' => [
'parent' => $term->id(),
],
]),
];
}
return $operations;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.