The complex widget uses $form_state['inline_entity_form'][$ief_id]['entities'].
The simple widget uses $form_state['inline_entity_form'][$ief_id]['entity'].

WidgetSubmit:;doSubmit() only covers $form_state['inline_entity_form'][$ief_id]['entities'], by accident.
(No bugs visible because the simple widget doesn't support deletion and closing entity forms).

Furthermore, each inline form has #entity, which also contains the entity being edited.
I'm pretty sure that needlessly ends up in form cache as well.

We need to unify all this, and build an abstraction around it, instead of fishing around $form_state.
Perhaps using the tempstore actually makes sense?

Comments

bojanz created an issue. See original summary.

bojanz’s picture

The first step is removing all IEF form state usage from the IEF form element. It's a form element, it has #default_value and #value, it doesn't need anything else.
Then we fix the Simple widget to stop using the non-standard form state key (leaving us only with the Complex variant).
Opened an issue for that: #2687653: Remove IEF form state usage from the form element, simple widget.

The second step is then to wrap the form state operations as used by Complex in an object.
The third step would be to investigate tempstore (which would also allow people to build dialog based inline forms).

bojanz’s picture

Title: Unify temporary entity storage » [meta] Unify temporary entity storage
Category: Task » Plan
bojanz’s picture

Title: [meta] Unify temporary entity storage » [meta] Refactor temporary entity storage

#2687653: Remove IEF form state usage from the form element, simple widget and #2688351: Remove IEF form state specific code from EntityInlineForm are done.

We now only use the form state in the Complex widget. What remains is the refactoring.