Problem/Motivation

This is a follow-up of #3540040: Prevent moving components on Translate edit page

Paragraph behavior settings (behavior_settings) are not translatable: the value is shared by every translation.
Paragraph's own ParagraphsWidget already hides the behavior settings on a translation form when the paragraph type has "Hide non translatable fields on translation forms" enabled. The Layout Paragraphs component edit form does not: it always shows the behavior settings, even while translating with that option on, on the paragraph type or the host. So an editor can change a non-translatable, shared value from a translation form.

The parent issue added LayoutParagraphsLayout::layoutChangeAccess(), which already encodes this rule (allowed unless you are editing a translation, the paragraphs field is untranslatable, and the host hides untranslatable fields). It is used for structural edits (add, remove, move, reorder, editing layout components) but not for behavior settings.

Steps to reproduce

1. Enable translation on a content type and check "Hide non translatable fields on translation forms".
2. Keep the Layout Paragraphs field untranslatable (symmetric translations).
3. Enable a behavior plugin on a paragraph type used in that field.
4. Create content in the default language, then create/edit one of its translations.
5. Open a component to edit it: the behavior settings are still shown and editable.

Proposed resolution

Make the component edit form hide the behavior settings when the paragraph type hides untranslatable fields, the same way ParagraphsWidget does, or when layoutChangeAccess() denies the change. The latter is stricter than ParagraphsWidget, which ignores the host setting, but Layout Paragraphs stores its structure in behavior_settings.

Remaining tasks

- Review the MR against 3.0.x.

User interface changes

When editing a translation on a host or paragraph type that hides untranslatable fields, the component edit form no longer shows the behavior settings. Translatable fields are unchanged. There is no change on the default translation, or when the option is off on both.

API changes

None

Data model changes

None

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

herved created an issue. See original summary.

herved’s picture

Status: Active » Needs review
andras_szilagyi’s picture

Status: Needs review » Reviewed & tested by the community

A good addition to the parent issue, works as described. Thank you.

claudiu.cristea’s picture

Title: [PP-1] Hide behavior settings when translating » Hide behavior settings when translating
herved’s picture

Status: Reviewed & tested by the community » Needs work

I'll create a new branch against 3.x and rework tests

herved’s picture

Version: 2.1.x-dev » 3.0.x-dev

herved’s picture

Issue summary: View changes

herved changed the visibility of the branch 3606233-behavior-translation to hidden.

herved’s picture

Status: Needs work » Needs review

justin2pin made their first commit to this issue’s fork.

justin2pin’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.