Problem/Motivation
When editing a Display Builder node override on a translated node page (e.g., French translation) and publishing, the layout data is written to the default language (e.g., English) node's field instead of the translation being edited.
The frontend rendering reads from the correct translation's field (since the node entity in the rendering context is the correct translation), so the published layout appears correct on the frontend. But the working copy (Instance entity) is shared across translations, and publishing overwrites whichever language's field the reconstructed plugin happens to load — always the default.
Steps to reproduce
- Enable content translation for a node type and install Display Builder entity_view_override on that bundle
- Create a node in the default language (e.g., English) and add a translation (e.g., French)
- Open the Display Builder for the French translation (/fr/node/{nid}/display/default)
- Make layout changes and click Publish
- Check the English translation's Display Builder — the French layout data has been written to the English node's field
Proposed resolution
The display_builder_instance entity ID for entity_view_override overrides follows this format:
entity_override__{entity_type}__{entity_id}__{field_name}
This ID contains no language information, so all translations of the same entity share a single Instance entity as their working copy.
When publish() is called (Instance::publish() → getBuildablePlugin() → EntityViewOverride::__construct()), the plugin is reconstructed from the stored buildable.configuration, which only contained entity_id (node ID, e.g. 123). No langcode was stored. The constructor then calls:
$entity = $storage->load($this->configuration['entity_id']);
This always loads the default translation of the entity in the current language context, regardless of which translation was being edited. Consequently, saveSources() writes to the default language node's field.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork display_builder-3611826
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 commentedComment #4
pdureau commentedComment #5
ipumpkinupdate status Needs review
Comment #6
ipumpkinComment #7
ipumpkin