Generated with the help of an LLM.
Problem/Motivation
EntityViewOverride builds and publishes against the content's default revision, never the latest one.
On moderated content with a pending draft, publishing an override saves a new default revision from the published content.
The draft's other field changes drop out of the latest revision, and the display goes live without a transition.
Steps to reproduce
- Apply an editorial workflow to a content type with an override display enabled.
- Publish a node, then save a draft with a changed title.
- Open the override builder for that node and publish the display.
- The new default revision carries the published title, and the draft is no longer the latest revision.
Proposed resolution
The override builder loads the latest revision, and publishing saves into it without changing its moderation state.
The display then goes live with the content's next transition, made on the content form.
Remaining tasks
- Narrow MR !552 to this fix, or open a new one.
- Kernel test that keeps the pending draft through a publish.
User interface changes
None.
API changes
Any signature change the future submodule needs, such as publish() taking a transition, lands here before RC1.
Changing an interface method after RC1 breaks every implementer.
Data model changes
None.
Issue fork display_builder-3639104
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 #3
mogtofu33 commentedThe override builder now loads the latest revision, through
load_latest_revisionon its route andEntityRepository::getActive()for a stored instance, as the content edit form does.Publishing and reverting then save into the pending draft and leave the live revision alone.
publish()takes an optional?string $action_idfor the content moderation submodule of #3636153: Entity view overrides Content Moderation/Workflow support.Every plugin in this module throws on a non-NULL action.
Comment #4
prince.wangTest with content moderation enabled, Builder always working on the lastest revision data and keep current moderation state, no pending draft data loss.
Comment #5
prince.wangadd publish action support in
ApiPublishingControllerwould be a good place in this MRhttps://git.drupalcode.org/project/display_builder/-/merge_requests/571/...
Comment #6
mogtofu33 commentedThanks for testing it with content moderation.
I would keep the controller out of this MR: no plugin accepts an action yet, so reading
actionfrom the request would only turn a crafted POST into an error.Controllers are not API, so the parameter can land with the submodule in #3636153: Entity view overrides Content Moderation/Workflow support after RC1, without a change record.
This MR only freezes the
publish()signature before RC1.