Consider form alters when validating closed paragraphs

Created on 9 July 2024, 9 months ago

Problem/Motivation

It's possible to alter the paragraph form for example in hook_field_widget_single_element_paragraphs_form_alter(). Any changes made through altering are, however, only reflected in paragraph validation if the paragraph is open, not if it's collapsed.

Steps to reproduce

1. Create a paragraph with a required field.
2. Create a hook_field_widget_single_element_paragraphs_form_alter() hook and conditionally remove access / the required attribute based on, for example, the entity the paragraph is in.
3. The hidden field causes a validation error if the paragraph is collapsed. If it is, the form alter is processed and the change is applied.

Proposed resolution

Apply the form alters somehow whenever validation errors are detected similarly to 🐛 Paragraphs widgets validates fields that are not in the current form display RTBC . I tried to produce a patch for this, but couldn't figure out how to render only a single paragraph entity form.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇫🇮Finland ZeiP

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

Comments & Activities

Production build 0.71.5 2024