Original issue:

When on edit article form -> media entity image is edited in image paragraph and after that article is saved. Media image entity is also saved properly.
But when image paragraph is collapsed before saving of article, changes are not applied to media entity image.

State of paragraphs form collapsing.

Problem/Motivation

There are multiple implementations of Inline entity forms in the paragraph widget,
collapsing one of these, changes to the form are lost when re-opening the form or saving the node.

Following use cases are known:

* InlineEntityFormSimple widget
Fix in https://www.drupal.org/node/2901158

* InlineEntityFormComplex widget
Paragraphs Collapse button would need a '#ief_submit_trigger' flag without adding the submit callbacks provided by inline_entity_form module for this to work.
Also some work needs to be done in InlineEntityFormComplex->extractFormValues().

* EntityBrowser widget which includes InlineEntityForm after selection/creation in modal.
InlineEntityForm is returned as a entity display leading to paragraphs 'collapse' button triggering the wrong widget: (EntityReferenceBrowserWidget->extractFormValues()) which has no implementation for handling the state of the InlineEntityForm.
Also the structure of the form_state is messed up by this (additional 'display' key in parents).
See https://www.drupal.org/node/2858438

* InlineEntityFormComplex with EntityBrowser as initial 'add existing' selector
Works.

Proposed resolutions

* Extend InlineEntityFormSimple with EntityBrowser as initial 'add existing' selector based on functionality in InlineEntityFormComplex.
* Add inline_entity_form submit callbacks to the 'collapse' buttons: save the entities when collapsing somehow also fixing the issues.
* Rework collapse button to only hide/show form parts using css, not actually doing an ajax submit and removing part of the form from the DOM.
* Disable collapse button for problematic forms, basically these using the EntityBrowser widget with the InlineEntityForm display.

Comments

mtodor created an issue. See original summary.

daniel.bosen’s picture

Priority: Normal » Critical
volkerk’s picture

Issue summary: View changes
volkerk’s picture

Issue summary: View changes
volkerk’s picture

Status: Active » Needs review

Decided to add inline_entity_form submit callback to the 'collapse' buttons and renaming them 'Collapse and save' for inline entity forms inside paragraph forms.

https://github.com/BurdaMagazinOrg/thunder-distribution/pull/392

daniel.bosen’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.