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.
| Comment | File | Size | Author |
|---|---|---|---|
| child.txt | 2.75 KB | Bastlynn | |
| parent2.txt | 3.57 KB | Bastlynn | |
| parent1.txt | 3.57 KB | Bastlynn |
Comments
Comment #1
Bastlynn commentedA 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.
Comment #2
ademarco commentedThanks for the well reported issue! I'll have a look at it as soon as possible.
Comment #3
ademarco commentedOk 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!
Comment #4
colemanw commentedFYI, my result when applying this patch:
Comment #5
ademarco commentedTo #4: where do you get this warning? Editing the field settings or in the node submission form?
Comment #6
colemanw commentedI 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.
Comment #7
Bastlynn commentedI'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!
Comment #8
wojtha commentedIssue from comment #4 solved here: #862362: Foreach() error in node_widget.form.inc:166 + node revisions are not being created