Updated: Comment #0

Views

Problem/Motivation

function hook_entity_operation_alter(array &$operations, \Drupal\Core\Entity\EntityInterface $entity) {}
was added in
#2004408-34: Allow modules to alter the result of EntityListController::getOperations
(there were some followups for random fails, so the history there is a bit confusing)

That hook was useful in #2004428: Less ugly operations altering

But, the hook did not effect some of the entities.
See #17-#24 in #2004428-17: Less ugly operations altering

#2019647: Use EntityListController for menus was opened because initially the thought was the menu operation was not added because it was not using a List Controller. It is using a list controller, it's injected through, not put in the annotations on the menu entity. (See comment #4 there.)

Proposed resolution

Make the hook work/ change something about Views so the hook works.

Remaining tasks

User interface changes

No.

API changes

?

Comments

Gábor Hojtsy’s picture

Issue tags: +D8MI, +language-config

The code in Drupal\views_ui\ViewListController::buildOperations() looks like properly invoking the parent and it extends from Drupal\Core\Config\Entity\ConfigEntityListController. Not sure what is going on here.

kfritsche’s picture

This works in Core. I tested it with the config_translation module and we could clean up some code there.

$this->buildOperations($entity) is used to create the operations array in the View List Controller which issn't used in all Controllers yet.

The test still is useful to not loose this functionality in core.

Gábor Hojtsy’s picture

Status: Active » Closed (cannot reproduce)

config_translation has tests for this. So if we have the alter hook putting in the translate operation and it passes tests, then it works.

Gábor Hojtsy’s picture

Issue summary: View changes

added blocks issue