Is there an OOP alternative to hook_entity_operations_alter() in Drupal 8 In my custom module, I want to add a new action to the operations menu for each row of the user list that is displayed when going to /admin/people. I would like to stay in OOP-land and therefore I'm wondering if there is an alternative to implementing hook_entity_operations_alter() in my module? E.g. something that would allow me to create a PHP class for adding my action, or alternatively some way to add the action through the admin interface.

currently I have this code in somemodule.module:

/**
 * Implements hook_entity_operation_alter()
 */
function somemodule_entity_operation_alter(array &amp;$operations, EntityInterface $entity) {
  if($entity instanceof UserInterface){
    $operations['translate']['title'] = t('Hello @entity_type', array(
      '@entity_type' =&gt; $entity-&gt;getEntityTypeId(),
    ));
    $operations['translate']['weight'] = 99;
  }
}


This works, but as said I would like an alternative that would skip the .module file completely.
The operations originally come from UserListBuilder. You can extend this class and alter User entity info to point list builder property to your class. The problem is that you need to implement hook_entity_type_alter wich is not in OOP land :-).

I suggest you keep this hook until Drupal become a true OOP application.

This article contains a quck comarision of hooks vs OOP events.