Create a paragraph type with an entity_reference field using inline_entity_form.
Add a paragraphs field to a node, make the paragraph type available and use paragraphs widget in 'Closed' edit mode.

Add a node with a paragraph, enter some test values and save. Edit the node again, edit the paragraph, now collapse the paragraphs subform: Your changes to the subform will be lost.

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:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

volkerk created an issue. See original summary.

volkerk’s picture

Issue summary: View changes
volkerk’s picture

Project: Paragraphs » Inline Entity Form
volkerk’s picture

Fixes lost values in form rebuild, requires patch from #2830829.

volkerk’s picture

nkoporec’s picture

Status: Needs review » Needs work

Tested your patch, and it does work on simple widget but I think we should implement this on complex widget too. Also small coding standards issues:

1. Expected one space after closing parentheses.

+    if (!$widget_state){
+      $form_state->set(['inline_entity_form', $ief_id], []);
+    }

2. I think moving the comment from EntityInlineForm to InlineFormInterface should be a separated issue(or added to existing similar issue) since it's not related to this one and should be remove from the patch.

volkerk’s picture

1. Fixed cs.
2. Removed. Could you point out the existing similar issue?

neeravbm’s picture

I just tested the patch. As @nkoporec mentions, it works for simple widget but not for complex widget. For complex widget, there is an Update button though so it could be a workaround. But I do agree that it needs to be implemented with complex widget as well.

tonytheferg’s picture

I am having an issue using complex IEF that are nested in a node. I have a 1:1 product and variation in an inline entity form, and when you attempt to edit the form, you can update the product (parent), but but you cant update the child (variation). If you save the node with the IEF open in edit mode, the child updates as you would expect it to by simply updating the IEF.

It sounds like this is a common problem, unrelated to products from this on Drupal Answers, so I am wondering if this is the right issue?

subhojit777’s picture

patch rerolled

Status: Needs review » Needs work

The last submitted patch, 10: 2901158-10.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

subhojit777’s picture

Status: Needs work » Needs review
FileSize
3.33 KB

forgot to add the import

miro_dietiker’s picture

Issue tags: +Needs tests

I think it would really help to have tests here to avoid breaking this again in future.

geek-merlin’s picture

Status: Needs review » Postponed (maintainer needs more info)

IEF rc9 is out and has some fixes for nested forms. Can this still be reproduced?

keopx’s picture

Assigned: volkerk » Unassigned
Status: Postponed (maintainer needs more info) » Needs work

The problem continues and it cannot be applied

Spokje’s picture

Reroll of #12

chr.fritsch’s picture

Status: Needs work » Needs review
FileSize
3.29 KB
6.57 KB

I tried to build a small test the shows that there is a general problem during ajax requests, that the form is not rebuild properly.

daniel.bosen’s picture

Status: Needs review » Reviewed & tested by the community

The test is quite nice, I think. And the actual patch has proven to fix the problem for years now and we need it for multiple modules. "Entity reference actions" and "Media Library Media Modify" both have it as patches in their composer.json files.
Would be really nice to get this one in!

geek-merlin’s picture

TBH i do not completely grok that, but changes look reasonable, and we now have a test.
If someone makes a MR, it's easier for me to commit.

chr.fritsch’s picture

Issue tags: -Needs tests

Sure, here you go :)

geek-merlin’s picture

Status: Reviewed & tested by the community » Fixed

Thanks everyone for working on this!
Committed and rolled new release. Rock on!

Status: Fixed » Closed (fixed)

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

heddn’s picture

This commit caused regressions with non paragraph IEF fields. I have an (albiet complex) IEF implementation for user that completely broke after this commit. Any chance this could see a revert while a test coverage and fixes are added?

heddn’s picture

geek-merlin’s picture

As @heddn noted, this change caused a regression, so it was reverted in #3270348: Regression from #2901158.
Please continue in #3271293: Changes are lost when collapsing a paragraphs subform including an inline_entity_form