Problem/Motivation
Assume we have a subform (Profile, Inline Entity Form, ...).
Assume some other module (Conditional Fields, ...) altering the form needs to know the model (entity, config) of widget.
Problem:
Subforms and individual widgets don't carry information about their model. Ex.: If we have a profile entity as user subform, the altering module can not (without coding profile knownledge in) identify the profile subform fields.
Of course we can work down an infinite series of "Integrate [subform provider] with [form alterer]" issues, but that's a real kitten massacre ☠.
TODO: Link more instances of this problem.
Proposed resolution
This can be approached in several directions:
a) Give every widget the analog of D7's #field, a widget object that can be introspected (and maybe can do something like #validate). Maybe add something like FormElement::getWidgetObject() as companion of FormStateInterface::getFormObject().
b) Extend SubformState to point to its datasource/model.
A first look points to a) as it seems more general. Als it looks like the idea of only one form controller (and no subform controllers) is a very basic assumption of the current form implementation, so b) looks very hard to approach.
Remaining tasks
Discuss, implement, commit.
User interface changes
None.
API changes
Maybe.
Data model changes
Maybe.
Comments
Comment #2
geek-merlinComment #3
geek-merlinComment #4
geek-merlinComment #11
geek-merlin