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

Command icon 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:

Comments

geek-merlin created an issue. See original summary.

geek-merlin’s picture

geek-merlin’s picture

Issue summary: View changes
geek-merlin’s picture

Issue summary: View changes
geek-merlin’s picture

Assigned: Unassigned » geek-merlin
Status: Active » Needs review