hook_entity_operation_alter

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

Alter entity operations.

Parameters

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

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

Related topics

Hooks
Define functions that alter the behavior of Drupal core.

File

core/lib/Drupal/Core/Entity/entity.api.php, line 1840
Hooks and documentation related to entities.

Code

function hook_entity_operation_alter(array &$operations, \Drupal\Core\Entity\EntityInterface $entity) {
  // Alter the title and weight.
  $operations['translate']['title'] = t('Translate @entity_type', array(
    '@entity_type' => $entity->getEntityTypeId(),
  ));
  $operations['translate']['weight'] = 99;
}
doc_Drupal
2016-10-29 09:18:00
Comments
Leave a Comment

Please login to continue.