Problem/Motivation
Once #3541151: Content display overrides: Form widgets and #3531523: Migration from Layout Builder (config only) are done, we will be able to execute the migration also for content overrides.
Proposed resolution
When an Display Builder override is initialized, there are 4 possible sources of data and we load the first in this order of priority:
- Field settings default value: the first, not because we want but because it seems Field API is forcing it. It may be the opportunity to challenge that.
- Existing Layout Builder override (only for default display): priority because we keep existing content
- Display Builder entity view display config: the most usual and expected situation. the scope of this ticket
- Existing Layout builder config (if we do #3540048: Allow override of displays not build with display builder)
Issue fork display_builder-3542859
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
pdureau commentedThe migration is located in BuilderDataConverter::convertFromLayoutBuilder()
We are triggering it only from config right now, from the implementation of
DisplayBuildableInterface::getInitialSources():https://git.drupalcode.org/project/display_builder/-/blob/1.0.x/modules/...
It seems the migration logic would stay the same, we lmay just need to trigger it from content too:
DisplayBuildableInterface::getInitialSources()is also implemented in https://git.drupalcode.org/project/display_builder/-/blob/1.0.x/modules/...Comment #3
pdureau commentedComment #4
pdureau commentedComment #5
pdureau commentedComment #7
pdureau commentedComment #8
grimreaperComment #9
grimreaperI think the issue needs steps for testing.
I put some review comments.
I have tested the following scenario:
- create a content type
- enabled LB and LB overrides (default view mode)
- configure LB on this entity view display (add a 2 columns section and place field blocks in it)
- create one content
- create another content and override its LB but adding a block content.
- add a UI source field on the content type
- enable DB and DB overrides on the default view mode
- save entity view display DB configuration
- both contents have the same display, the default DB. When trying to override the DB on one of the content it is the default DB that is used not its previous LB overrides.
Is it what is expected?
Comment #10
pdureau commentedComment #11
pdureau commentedHi Florent,
You are right, it must be clarified and documented.
Current state of the MR
Before talking about import and conversion, we notice Display Builder takes the lead over Layout Builder to render a content (even when there is a Layout Builder override in content).
However, the import (& conversion) when we open a DB override for the first time (ie, when there is no data in stored in the field already), is not following this priority order:
This difference is confusing, we must align the mechanisms. How?
Proposal 1: Display Builder always win
Same priority order for display and import:
Proposal 2: Overrides always win
Maybe it is confusing to lose all LB overrides once Display Builder is activated in a display, it changes the display of existing content. It breaks the content in a way.
Same priority order for display and import:
Comment #12
grimreaperYes, I thought current MR state was proposal 2.
Comment #13
grimreaperDiscussed, we agreed on the following behavior, but current implementation is incorrect then.
Comment #14
pdureau commentedWork as expected. Kernel tests added.
Still a playwright fail in pipeline, but doesn't seem related to the current work.
Comment #15
grimreaperStill not working as expected for me.
Will need to see that in meet.
Comment #16
pdureau commentedok let's talk
Comment #17
grimreaperSeen with @pdureau, manual test ok, I missed a step in the tests.
Minor changes to do on the MR.
Comment #18
pdureau commentedChanges asked by Florent: done
Remaining: playwright fail:
Comment #19
pdureau commentedHi Jean
I am sorry to send the issue to you with a playwright fail but i am not reproducing it locally. Switching back to RTBC because checked by Florent.
However, it is very important to merge #3549266: Move DisplayBuildableInterface to a new plugin type before this one because they may conflict. I am OK to do the rebase my self if conflicting.
Comment #20
mogtofu33 commentedLooks like a real problem with Entity View Override:
Comment #21
pdureau commentedOk thanks, i am having a look.
Comment #22
pdureau commentedAside the playwright fail, there is something else to check before sending to review:
defaultdisplay stored inOverridesSectionStorage::FIELD_NAMEui_patterns_sourcefieldNow, we are importing from Layout Builder Override when we are initializing data for any Display Builder Overrides. Maybe we need to check the display entity ID is the same in both (so it will work only for
default).Comment #23
pdureau commentedonly playwright left :)
Comment #24
pdureau commentedComment #25
grimreaperHello,
I reviewed the last changes, ok for me
Comment #26
pdureau commentedComment #27
mogtofu33 commentedNeed to work on the tests, they look a lot like Functional tests candidate and not Kernel.
These are testing a process through multiple methods, Kernel should cover only one class.
Will update them.
Comment #28
mogtofu33 commentedCreated functional tests for simplicity.
Comment #29
mogtofu33 commented