You are here

function taxonomy_term_depth_entity_operation in Taxonomy Term Depth 8.2

Implements hook_entity_operation_alter().

File

./taxonomy_term_depth.module, line 323
Main module file.

Code

function taxonomy_term_depth_entity_operation(EntityInterface $entity) {
  $entity_type_id = $entity
    ->getEntityTypeId();
  if ($entity_type_id == 'taxonomy_vocabulary') {
    $operations = [];
    $entity_id = $entity
      ->id();
    $operations['taxonomy_term_depth_update'] = [
      'title' => t('Update term depths'),
      'weight' => 26,
      'url' => Url::fromRoute('taxonomy_term_depth.update_depth_form', [
        'taxonomy_vocabulary' => $entity_id,
      ]),
    ];
  }
  return $operations;
}