Collapsed paragraph cannot be opened within the IEF on a translation page

Created on 29 December 2023, 11 months ago
Updated 6 January 2024, 11 months ago

Problem/Motivation

If you add a nested structure Paragraph >> ContentEntity >> IEF >> ContentEntity, the paragraph is not displayed correctly on the translation page.

Screencast: https://www.awesomescreenshot.com/video/23640588?key=9beecfed4a76078355c...

Steps to reproduce

Apply patch #8 from Show non-translatable fields instead of hiding them Show non-translatable fields instead of hiding them Needs work

Add Paragraphs type.
Add field "Text (plain)" (single value). Check "Users may translate this field".

Add vocabulary: check "Enable translation" in "Term language", save.
Add field "Reference revisions - Paragraph (unlimited)" to new paragraph type
Form widget "Paragraphs (stable)" with "Edit mode" = Closed.

Create content type: Click "Enable translation" in "Language settings", save.
Add field "Reference - Term (unlimited)" to new vocabulary. Check "Users may translate this field".
Form widget "Inline entity form - Complex".

On /admin/config/regional/content-language:
Check "Content" in "Custom language settings". In "Content" section check new paragraph type and check new text field.
Check "Paragraph" in "Custom language settings". In "Paragraph" section check new paragraph type.
Save.

Settings screenshots:

My investigation

On ajax call form is building OK.
The problem is in $form_state->getTriggeringElement(). It returns wrong element and wrong form part is returned in FormAjaxResponseBuilder.php:

// We need to return the part of the form (or some other content) that needs
// to be re-rendered so the browser can update the page with changed
// content. It is up to the #ajax['callback'] function of the element (may
// or may not be a button) that triggered the Ajax request to determine what
// needs to be rendered.
$callback = NULL;
if (($triggering_element = $form_state->getTriggeringElement()) && isset($triggering_element['#ajax']['callback'])) {
  $callback = $triggering_element['#ajax']['callback'];
}

Update 1:
If a paragraph translation has already been added, the issue goes away.

Update 2:
Collapse all and Edit all buttons works fine.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇷🇸Serbia super_romeo Belgrade

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024