I ran into this while working on my site and wanted to let you know - when a child node has two or more parents, there is a bug in the function node_widget_get_fields(&$form), in file node_widget.form.inc - the code is unable to pass into the if statement to reach line:

$fields[$field_name] = $field;

The reason is the second check on the if: && $form['type']['#value'] == $field['type_name']

For some reason, the second parent name will come up on the first parent submission forms. The second parent performs as expected. This may be an oversight in CCK, but it matters where a child has multiple references.

I've attached the test cases I used to figure this out.

CommentFileSizeAuthor
child.txt2.75 KBBastlynn
parent2.txt3.57 KBBastlynn
parent1.txt3.57 KBBastlynn

Comments

Bastlynn’s picture

A bit more information, this seems to only happen when the field names are shared.

You can nodereference to the same type of node from multiple parents, so long as you name the fields differently for each nodereference field.

ademarco’s picture

Thanks for the well reported issue! I'll have a look at it as soon as possible.

ademarco’s picture

Status: Active » Needs review

Ok I've committed a change which should solve the problem: http://drupal.org/cvs?commit=348762

Could you check if everything works well for you? Thanks!

colemanw’s picture

FYI, my result when applying this patch:

warning: Invalid argument supplied for foreach() in /sites/all/modules/node_widget/includes/node_widget.form.inc on line 166.
ademarco’s picture

To #4: where do you get this warning? Editing the field settings or in the node submission form?

colemanw’s picture

I get it on admin/content/node2 (a view provided by views bulk operations module). Not sure why, let me know if you need more info.

Bastlynn’s picture

I'm getting back in from a trip this week - I'll check it on my install once I get back to my dev box. :) Thanks for figuring this one out!

wojtha’s picture