Problem/Motivation
Evidence suggests that mankind has tried to embed forms ever since the first tribes managed to invent bureaucracy. As a species, we have been able to launch software, start-ups, people into space, and the Eurovision Song Contest, but never have we achieved that what our ancestors wished for.
Embedding forms is nothing more than using multiple objects to build parts of a larger form. The idea is that by providing abstraction between parent forms and subforms, we improve the reusability of individual components. #2537732: PluginFormInterface must have access to the complete $form_state (introduce SubFormState for embedded forms) tries to fix this for form states. Currently, there is no interface for embedded forms, other than PluginFormInterface
, which can technically be reused, but it's very much part of the plugin system.
Let's make our ancestors proud!
Proposed resolution
Introduce SubformInterface
, which uses SubformStateInteface
as introduced by #2537732-69: PluginFormInterface must have access to the complete $form_state (introduce SubFormState for embedded forms).
Remaining tasks
None.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#8 | introduce-2653106-8.patch | 1.4 KB | borisson_ |
Comments
Comment #2
XanoThis is functionally equivalent to
PluginFormInterface
, which, as mentioned in the issue summary, is technically what we want, but without the$form
parameter to::buildSubform()
, because the subform's render array does not exist at that time, and the parent form should not make assumptions about the subform's structure and vice versa. Such dependencies belong in interfaces.Comment #3
XanoComment #4
fagoyes, a proper solution to the old subform problem would help in many different cases. I remember there were some issue suggesting to care for embedded or embeddable forms. Actually, I must say I'd prefer the EmbeddedFormInterface terminology as it's more precise than "subform". The meaning of "subform" might not be so obvious.
+ * Because this is an embedded form, it is not responsible for handling a
Looks like the patch partly uses the embedded-terminology already, so let's better switch to that terminology completely.
Comment #5
XanoI'm not in favor of any particular name, as long as it's consistent with whatever name we choose in #2537732: PluginFormInterface must have access to the complete $form_state (introduce SubFormState for embedded forms).
Comment #7
XanoComment #8
borisson_Ran this trough coder, attached patch fixes it's remarks.
Comment #12
EclipseGc CreditAttribution: EclipseGc at Acquia commentedSubformStateInterface landed in core long ago and solved most of the technical problems associated with this. Closing.
Eclipse