Hey there!

Working on a Drupal distribution. Lots of fun stuff to do with this build. I'm using inline entity form. I am using inline entity reference for nested inline entities, or at least attempting to.


Here's the issue and how to reproduce it:

Create parent content type.
Create child content type
Create grandchild content type.

Parent has inline form for child.
Child has inline form for grandchild.

Go to create parent node form.
Add child node via entity form.
Add grandchild node via entity form.
Crate another child node via entity form.

That second child node, will inherit the created grandchild for the first child node.
Once the parent node is saved, all subsequent actions are 100% okay.


Any ideas? Is this a duplicate? I wasn't able to turn anything up.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

bojanz’s picture

1.5 has very fresh code for handling nested IEFs, I am guessing there are still a few bugs to shake out.
I'll try to reproduce.

jnicola’s picture

Thanks for responding! I can toss you the DB for the project I'm working on. Nothing critical in there, all test content and fake users.

I'm working in Turnkeylamp, php 5.4, etc etc.

adolfo.mansilla’s picture

Status: Active » Needs review
FileSize
5.61 KB

I have made some changes in the module. I can create and modify nested nodes with 3 deep levels.

jnicola’s picture

I'll try and find time to test this!

Does your patch work on NODE creation? I can get it to work on subsequent edits, but the issue appears related to a lack of a parent NID on initial node creation.

adolfo.mansilla’s picture

Yes, I tested it with content types.

bojanz’s picture

Status: Needs review » Needs work

I would not commit a patch such as the one in #3. It's hacky and tackles the problem at the wrong place.
IEF has fresh and powerful nesting code, the issue here is that previous form values are getting reused for a newly opened form.
Based on that, guessing that the actual bug is in inline_entity_form_cleanup_entity_form_state().

adolfo.mansilla’s picture

Status: Needs work » Needs review
FileSize
1.44 KB

Thanks for the tip. I been working on the issue. I uploaded the patch with new changes.

nicholas.alipaz’s picture

Patch in #7 wfm. Thanks

monaw’s picture

What's happened with this patch to fix the problem of duplicate nested grandchildren?

xlyz’s picture

#7 wfm as well. thanks

jnettik’s picture

Version: 7.x-1.5 » 7.x-1.x-dev
Status: Needs review » Reviewed & tested by the community

Same problem. #7 works for me too. I'm marking as RTBC. I also tested the patch against current dev.

metafunk’s picture

#7 works for me as well.
Is there any chance this will be rolled into the next release?

bojanz’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks.

  • bojanz committed 7895c2a on 7.x-1.x authored by adolfo.mansilla
    Issue #2206197 by adolfo.mansilla | jnicola: Fixed Nested Inline Entity...

Status: Fixed » Closed (fixed)

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

jmdall’s picture

Just to inform that I still having the same issue but more "randomly" with the latest dev version.
Haven't found a way to reproduce it right now.

drupalninja99’s picture

Getting errors on node/add page when I add a new inline entity:

Notice: Undefined index: field in field_widget_field() (line 578 of ../modules/field/field.form.inc).
Notice: Undefined index: instance in field_widget_instance() (line 603 of ../modules/field/field.form.inc).

The ajax throbber just spins. Adding existing entities works and adding a new inline entity on an existing node works.

drupalninja99’s picture

Also Notice: Undefined index: #ajax in ajax_form_callback() (line 391 of ../includes/ajax.inc).

adolfo.mansilla’s picture

More info about the error please. Installed modules, fresh install, custom fields, etc.

drupalninja99’s picture

It's not a fresh install, altho I could test it against a fresh install. There are all manner of modules, custom fields, etc. too many to name. I am going to investigate further.

drupalninja99’s picture

I did a clean install and enabled a couple features to enable the content type. I still have the problem. I do have translation modules enabled include a patch for inline entity forms.

drupalninja99’s picture

Doing some more testing it does look like this is a multilingual / inline entity problem so the issue is likely not with this patch.

jphelan’s picture

I'm having this issue but the nested field inside the inline entity is a paragraphs field, not another inline entity. Any idea how to revise this patch to cover that scenario as well?

jphelan’s picture

I'm having this issue in D8 as well.
https://www.drupal.org/node/2877484

anthonyalbertyn’s picture

I have the same problem as the original description on this bug on D7, but only when a field collection is used.

I have a landing page, and on that an entity reference field (set to multiple ). I have another content type (lets call it Component 1) and on that I have a field collection field (set to multiple) and on the field collection field I have an entity reference field (set to multiple).
When I create a new landing page, then use the entity reference on the landing page to add an instance of Component 1 to it, and then on Component one add a node via its entity reference field, then before saving the landing page, click add button to add a second instance of Component 1, then I can see then in the inline entity reference table on the second issuance of Component 1, I can see the referenced node from the first instance of Component 1.

If I remove the field collection from Component 1 and just have an entity reference on component 1 (ie not via a field collection) and repeat the above content adding then I do not experience the bug.

My site is multilingual but I have tested this on a fresh non multilingual Drupal 7 install and the same is true. Use a field collection in the chain and the bug is there, do not use a field collection and the bug is gone.

I am not sure whether I should create a new bug report, and whether this should be on the field collection module or on the inline entity reference form module. Any suggestions?

Robert Castelo’s picture