Problem/Motivation
Core does not have a notion of subforms (apart from \Drupal\Core\Form\SubformState, which helps with ::getValue in validate/submit).
We need some way to introspect subforms (and their nesting) in Hooks.
Proposed resolution
Create a suitable NestedSubformState and use it at least in hook_entity_prepare_form and hook inline_entity_form_entity_form_alter.
Remaining tasks
Code, review, commit.
User interface changes
None.
API changes
Pure API addition.
Data model changes
None.
Release notes snippet
Inline Entity Form extends how modules can hook into building IEF entity subforms:
- IEF now invokes hook_entity_prepare_form(EntityInterface $entity, string $operation, NestedSubformState $subformState),
- IEF now invokes hook_inline_entity_form_entity_form(array &$form, FormState $formState, NestedSubformState $subformState) with the new $subformState parameter.
For details see documentation of (TODO: Link)
- hook_entity_prepare_form
- hook_inline_entity_form_entity_form
- NestedSubformState
- EmbeddableEntityReferenceForm
Issue fork inline_entity_form-3226572
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:
- 3226572-nested-subform-state
changes, plain diff MR !32
Comments
Comment #2
geek-merlinComment #3
geek-merlinComment #4
geek-merlinComment #5
geek-merlin