Problem/Motivation
Right now EntityReferenceItem hardcodes dependencies from the DefaultSelection selection handler. Concretely, is using the DefaultSelection handler target_bundles
to build a list of dependencies, regardless of what effective handler is used by that field. But there are other selection handlers not extending DefaultSelection, like ViewsSelection (or even custom selection handlers) that have no target_bundles
setting (that belongs only to DefaultSelection). Those selection handlers are exposing other settings that are creating dependencies. Such dependencies are ignored when EntityReferenceItem calculates the field configuration dependencies. For example an entity reference field that uses a ViewsSelection selection handler should depend on the view that is configured in the field configuration. But right now in HEAD is not adding that view as dependency.
Proposed resolution
- Allow EntityReferenceItem to ask their selection handler plugin for dependencies when they calculate the field dependencies.
- Move the DefaultSelection specific dependencies from EntityReferenceItem into DefaultSelection.
- Introduce a new interface DependencyRemovalPluginInterface having an onDependencyRemoval() method.
- Make SelectionPluginBase implement also DependencyRemovalPluginInterface interface.
- Implement a generic onDependencyRemoval() that only returns FALSE in SelectionPluginBase.
- Create PluginRemovedDependencyTrait and move EntityDisplayBase::getPluginRemovedDependencies() there. This can be reused now in other similar cases.
- Implement calculateDependencies() in ViewsSelection.
- In EntityReferenceItem set the selection handler to broken when the dependency is deleted and cannot be resolved.
Remaining tasks
None.
User interface changes
None.
API changes
- New interface DependencyRemovalPluginInterface having an onDependencyRemoval() method.
- SelectionPluginBase implements now also DependencyRemovalPluginInterface interface.
- New trait PluginRemovedDependencyTrait.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#37 | 2786841-37.patch | 28.03 KB | jibran |
Comments
Comment #2
claudiu.cristeaComment #3
claudiu.cristeaComment #4
claudiu.cristeaComment #5
claudiu.cristeaComment #8
claudiu.cristeaFixed.
Comment #9
claudiu.cristeaNits.
Comment #11
claudiu.cristeaTest from #9 passed.
Comment #12
claudiu.cristeaComment #13
claudiu.cristeaI decided to split this issue by adding a prerequisite issue: #2787873: Add a base class for entity reference selection handlers and fix the structure of their configuration. Postponing on that.
Comment #14
amateescu CreditAttribution: amateescu for Pfizer, Inc. commentedNote that there's an existing issue for this: #2458337: Add missing config dependencies for the entity reference field type
Comment #15
claudiu.cristea@amateescu, thank you for pointing me to that. However, this issue seems a little bit different in terms of proposed solution. Here we're not only adding missed dependencies but we are introducing a mechanism that asks the plugin to provide its dependencies and we're also let the plugin react on dependency removal. If this issue gets committed, the other one becomes obsolete. For this reason and also because here we have a better, detailed IS I would prefer to keep this alive while marking the other as duplicate.
If you feel I'm wrong, please re-activate the other.
Updated also the IS after opened #2787873: Add a base class for entity reference selection handlers and fix the structure of their configuration.
Comment #16
jibranComment #18
claudiu.cristea#2787873: Add a base class for entity reference selection handlers and fix the structure of their configuration is in, this is NW now.
Comment #19
jibranThat got reverted.
Comment #21
jibranComment #22
jibranI meant NW.
Comment #23
jibranComment #24
jofitz CreditAttribution: jofitz at ComputerMinds commentedRe-rolled.
Comment #27
jibranComment #28
jibranYARR(yet another reroll)
Comment #30
claudiu.cristeaAssigning.
Comment #31
jibranComment #32
jibranYARR(yet another reroll)
Comment #33
jibranThis might fix some fails.
Comment #35
jibranCS fixes.
Comment #37
jibranFixed a deprecation warning.
Comment #39
andypost