function hook_entity_operation_alter
Same name in other branches
- 9 core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_operation_alter()
- 8.9.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_operation_alter()
- 11.x core/lib/Drupal/Core/Entity/entity.api.php \hook_entity_operation_alter()
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
2 functions implement 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 core/
modules/ system/ tests/ modules/ entity_test/ entity_test.module - Implements hook_entity_operation_alter().
- menu_operations_link_test_entity_operation_alter in core/
modules/ menu_link_content/ tests/ menu_operations_link_test/ menu_operations_link_test.module - Implements hook_entity_operation_alter().
File
-
core/
lib/ Drupal/ Core/ Entity/ entity.api.php, line 2129
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', [
'@entity_type' => $entity->getEntityTypeId(),
]);
$operations['translate']['weight'] = 99;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.