Problem/Motivation
While working on #2616814: Delegate all hook invocations to ModuleHandler, we discovered that workspaces_entity_load() takes its $entities argument by reference, which violates the hook_entity_load() interface.
Proposed resolution
Introduce hook_entity_load_alter() to directly solve the problem in the Workspaces module, and hook_ENTITY_TYPE_load_alter() to make this alteration behavior consistent with the other entity API hooks.
Remaining tasks
None.
User interface changes
None.
API changes
None. These are additions only.
Data model changes
None.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 3001101-8.patch | 1.61 KB | amateescu |
| #6 | drupal_3001101_6.patch | 12.65 KB | xano |
| #6 | interdiff.txt | 4.68 KB | xano |
Comments
Comment #2
xanoComment #3
xanoComment #4
xanoI added a change record.
Comment #6
xanoComment #7
joachim commentedThanks for filing this! :)
The real change here is in the Entity system, and I think this needs input from the maintainer.
Comment #8
amateescu commentedI think the existing hooks can do their job just fine, as proven by the current implementation in the Workspaces module. IMO there's no need to introduce two new hooks, we should fix their documentation instead.
Comment #9
joachim commented> we should fix their documentation instead.
Their documentation is not wrong. Workspaces module is misusing them. This isn't a bugfix, this is an API addition. Some of this discussion was already had over at the issue that spawned this one: #2616814: Delegate all hook invocations to ModuleHandler.
Comment #10
amateescu commented@joachim, ah, I see! Then this is a duplicate of #2928888: Add a hook_entity_preload() for modules that need to load a different revision than the default one :)
Comment #11
joachim commentedYup. I wasn't aware of that older issue.
Restoring the original title so it matches the issue summary.