[2.0.0-alpha3] Refactoring of form elements

Created on 17 June 2024, 5 months ago
Updated 1 July 2024, 5 months ago

Problem/Motivation

The actual situation in terms of "FormElement" in the ui_patterns 2.0.x code :
- component_form : build component selector form, and component form. The component form triggers component_props_form and component_slots_form, passing data (contexts..etc)
- component_props_form, build a complex form, one complex form per prop of the selected component. sources are fetched according to prop type and contexts
- component_slots_form : build a complex form, one complex form per slot of the selected component sources are fetched according to prop type and contexts

Some issues :
- The way we deal with sources can be improved, especially that now we have "tags" in sources, and the source plugin manager supports tag_filtering.
- In others issues #3423185 ✨ [2.0.0-alpha3] Add allow_expose source plugin Active & #3444768 ✨ [2.0.0-alpha3] Blocks: Add sources with an entity context Needs review , we may need to re-use a source selector, but the current implementation is oriented toward the form of a whole component, and do not really split nicely the implementation of each prop and slot, which are mixed into the component_props_form and component_slots_form elements.
- The way we handle ajax is a bit tricky, because we play with array_parents. We may need to enforce the way it is done to ensure implement keeps nice and robust.

Steps to reproduce

Proposed resolution

We refactor the form elements to have component_prop_form and component_slot_form (or a generic one for both?) :
we explicitly add new arguments like : tags, form_array_parents..etc
Note that the tags are used to fetch the sources accordingly.
form_array_parents is used to properly interact with form state and ajax.

The new code should allow reusing of component_prop_form or component_slot_form in a source plugin for example...

Remaining tasks

User interface changes

API changes

Data model changes

πŸ“Œ Task
Status

Fixed

Version

2.0

Component

Code

Created by

πŸ‡«πŸ‡·France just_like_good_vibes PARIS

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