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

  1. Enable content translation for a node type and install Display Builder entity_view_override on that bundle
  2. Create a node in the default language (e.g., English) and add a translation (e.g., French)
  3. Open the Display Builder for the French translation (/fr/node/{nid}/display/default)
  4. Make layout changes and click Publish
  5. 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

Command icon 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

ipumpkin created an issue. See original summary.

mogtofu33’s picture

pdureau’s picture

ipumpkin’s picture

Status: Active » Needs review

update status Needs review

ipumpkin’s picture

Status: Needs review » Needs work
ipumpkin’s picture

Status: Needs work » Needs review