Main entity language change does not propagate to nested paragraphs in preview mode

Created on 17 February 2023, almost 2 years ago

Problem/Motivation

In a nested paragraph structure the change of the language on the main entity does not propagate for paragraphs that are in preview mode. The implication of this is as well that language code changes will never propagate to any entity reference widget that is referenced from the first level paragraphs - this includes the paragraphs widget and the inline_entity_form one as well any other more complex non-default Drupal core widget for entity references that might be providing inline editing. The bigger issue appears when one translates later the main entity in the first translation of the content - in this case the second level paragraph will remain only with one translation.

Steps to reproduce

Consider a nested paragraphs structure in a multilingual setup, where there is one paragraph type "Accordion" that can itself reference paragraph entities of type "Accordion item".

1. Create new content with one Accordion paragraph and one nested Accordion Item paragraph and set English as the Language of the content.
2. Configure the widget settings to use a preview mode for both paragraph types.
2. Navigate to the edit page of the content and change the language to German and save while both paragraphs are in preview mode.
3. Check in the database and observe how only the first paragraph got its language changed.

Proposed resolution

1. Detect if a language code change was made.
2. If so for paragraphs in preview mode execute the submission for every non-default Drupal core widget for entity reference fields of that paragraph.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany hchonov πŸ‡ͺπŸ‡ΊπŸ‡©πŸ‡ͺπŸ‡§πŸ‡¬

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @hchonov
  • Status changed to Needs review almost 2 years ago
  • πŸ‡©πŸ‡ͺGermany hchonov πŸ‡ͺπŸ‡ΊπŸ‡©πŸ‡ͺπŸ‡§πŸ‡¬

    The attached patch executes the form displays and updates the langcodes of all paragraphs entities along the structure. It still requires work but should something to start a discussion on about how this could ideally be tackled.

Production build 0.71.5 2024