Problem/Motivation
Since #3594228: Remove explicit references to Layout Builder, a display declares no dependency on its sources, so core no longer deletes it with the field.
The sources stay, and rendering an entity of that bundle throws PluginNotFoundException.
#3562750: Field, Theme or module uninstalled only covers page layouts: its pruning needs onDependencyRemoval(), which only an entity class can implement.
Views displays have the same gap, see #3562750-21: Field, Theme or module uninstalled.
Steps to reproduce
- Build a display with Display Builder, with a source using a field.
- Delete the field.
- View an entity of that bundle: it fails.
Proposed resolution
Prune the sources from hooks with SourceTree::onDependencyRemoval(): hook_ENTITY_TYPE_predelete() for fields and hook_module_preuninstall() for modules.
Themes stay out: core has no hook before a theme uninstall, and the summary of #3562750: Field, Theme or module uninstalled accepts that fatal.
Remaining tasks
Check the hook order, then add tests.
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork display_builder-3634894
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
mogtofu33 commentedComment #3
mogtofu33 commentedComment #4
pdureau commentedI will have a first look.
Comment #5
pdureau commentedSince #3594228: Remove explicit references to Layout Builder, a display declares no dependency on its sources, so core no longer deletes it with the field.
Indeed, this missing part was identified during the work:
But forgotten from what we delivered.
We may already have similar issue with Views, let's check it too.
The #3540069: Evaluate ObjectWithPluginCollectionInterface may be interesting for Page Layout and Patterns because we "own" the entity logic, but for Entity View and Views, we don't own it and may need to rely on hooks.
Comment #7
pdureau commentedStarted
Comment #8
pdureau commentedRebase caused a playwright fail. On it.