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
Issue fork layout_paragraphs-3606233
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
herved commentedComment #4
andras_szilagyi commentedA good addition to the parent issue, works as described. Thank you.
Comment #5
claudiu.cristea#3540040: Prevent moving components on Translate edit page is merged.
Comment #6
herved commentedI'll create a new branch against 3.x and rework tests
Comment #7
herved commentedComment #9
herved commentedComment #11
herved commentedComment #14
justin2pin commented