function hook_entity_operation_alter

Alter entity operations.

Parameters

array $operations: Operations array as returned by \Drupal\Core\Entity\EntityStorageControllerInterface::getOperations().

\Drupal\Core\Entity\EntityInterface $entity: The entity on which the linked operations will be performed.

Related topics

1 function implements hook_entity_operation_alter()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

entity_test_entity_operation_alter in drupal/core/modules/system/tests/modules/entity_test/entity_test.module
Implements hook_entity_operation_alter().

File

drupal/core/includes/entity.api.php, line 549
Hooks provided the Entity module.

Code

function hook_entity_operation_alter(array &$operations, \Drupal\Core\Entity\EntityInterface $entity) {
  $uri = $entity
    ->uri();
  $operations['translate'] = array(
    'title' => t('Translate'),
    'href' => $uri['path'] . '/translate',
    'weight' => 50,
  );
}