function taxonomy_entity_operation
Same name in other branches
- 11.x core/modules/taxonomy/taxonomy.module \taxonomy_entity_operation()
Implements hook_entity_operation().
File
-
core/
modules/ taxonomy/ taxonomy.module, line 146
Code
function taxonomy_entity_operation(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.