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.
- 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.
User interface changes
- New interface DependencyRemovalPluginInterface having an onDependencyRemoval() method.
- SelectionPluginBase implements now also DependencyRemovalPluginInterface interface.
- New trait PluginRemovedDependencyTrait.
Data model changes