This issue is similar to https://www.drupal.org/node/2343689 but not quite the same, and is not fixed by the same patch.

Scenario: A field is setup as a "Inline entity form - Multiple values" field, and the user has multiple values for the field. The user presses the "Edit" button on each IEF value for the same field. If the user edits information on multiple at once while they are open, and closes one, it closes all the multiple values, and only saves the information on the field they happened to press save on.

I believe this behavior is due to the inline_entity_form_get_element function, specifically line 1565 on the development branch. To get the IEF element, this function reaches back up the tree until it hits the "#ief_root." For a multiple value field, this is the entire field, including all the values. I would think it should only be the specific value where the triggering element lives.

I will follow this post up with a proposed patch. In my patch, instead of looking for the "#ief_root" flag, it would simply go up the tree until it finds an #ief_id. Please review and apply if this is a valid solution. If not, I am happy to dig further when I have time.

Thanks for all the great work on the module!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

choicelildice’s picture

Issue summary: View changes
choicelildice’s picture

choicelildice’s picture

Status: Active » Needs review
gabesullice’s picture

Status: Needs review » Reviewed & tested by the community

LGTM

+1 for a commit

choicelildice’s picture

Status: Reviewed & tested by the community » Needs work

Found more places this breaks IEF. Do not use patch. I will research more.

choicelildice’s picture

Ok, I went through and tried to find any place where this patch would break IEF when IEF tries to grab the entity form from the $element['entities'] array. I added a simple check to see whether we are on the ief_root, and if not, simply use the current $element as the entity form. I am hoping this fixes any other issues.

choicelildice’s picture

Status: Needs review » Needs work

Still not ready, will return again as soon as I can.

choicelildice’s picture

Ok, the issue I ran into above, was we still need $delta on inline_entity_form_remove_confirm. I tested this again and didn't hit issues this time, but it could use more testing.

cfmcoder’s picture

This patch seems to work, if there are no errors in the IEF form. However, if validation fails on one of the IEF fields, then:
1. no error message appears
2. all the IEF forms disappear, except for the form with the field in error

choicelildice’s picture

Thanks for the info cfmcoder, I will try to replicate on my end and see if I can find a fix.

choicelildice’s picture

Status: Needs review » Needs work

Cfmcoder has found some more issues with this patch. Needs more work.

choicelildice’s picture

Status: Needs work » Needs review
FileSize
6.47 KB

I updated the inline_entity_form_get_element to take a boolean as the third parameter. If/when ajax.inc is looking for the true IEF_root element, it will now find it. I am passing FALSE for the parameter in the module where we actually just want to find the nearest IEF element, not the root. Again, I have not seen an immediate issue with this, but it will need testing.

koosvdkolk’s picture

#12 seemed to solve this issue for us. The validation message did appear.

arunkumark’s picture

Status: Needs review » Reviewed & tested by the community

Tested the patch #12 manually. It seems to be working fine. The entity forms are closing properly when we have multiple open forms.

Tested the inline entity form in Drupal commerce.

The last submitted patch, 2: inline_entity_form-multiple_value_entity_reference_close_all-2395091.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 12: multiple_value_entity-2395091-12.patch, failed testing. View results

arunkumark’s picture

Issue tags: +Needs reroll

The patch not applies to latest dev version.

arunkumark’s picture

Status: Needs work » Needs review
FileSize
5.04 KB

I have rerolled the patch with the latest version of 7.x-1.x-dev branch.

Status: Needs review » Needs work

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