Change record status: 
Project: 
Introduced in branch: 
8.x
Introduced in version: 
8.0
Description: 

The new Entity List Controllers in Drupal 8 did not allow for entity operations to be altered earlier. Now they support this via a hook_entity_operation_alter() which gets an array of operations and allows for the list of operations to be modified or expanded. This allows for eg. adding common operations to entity listings across different entity types. See hook_entity_operation_alter() for more information on the specifics of this hook.

<?php
/**
* Alter entity operations.
*
* @param array $operations
*   Operations array as returned by
*   \Drupal\Core\Entity\EntityStorageControllerInterface::getOperations().
* @param \Drupal\Core\Entity\EntityInterface $entity
*   The entity on which the linked operations will be performed.
*/
function translation_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,
  );
}
?>

See Entity listing pages can be provided by a list controller for the original change notice on list controllers.

Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done