Problem/Motivation
After importing node references, a node id is displayed in the imported field, but the node is not referenced. During the import process, the referenced nid is assigned to the incorrect part of the $node structure.
[field_featured_questions] => Array
(
[und] => Array
(
[0] => Array
(
[nid] => 3362
)
)
[0] => Array
(
[nid] => 3696
)
)
It should look like this:
[field_featured_questions] => Array
(
[und] => Array
(
[0] => Array
(
[nid] => 3362
)
)
)
Proposed resolution
Apply the attached patch or re-reference the node id manually through the node edit interface.
Remaining tasks
Please review the patch. I opted to use the field API instead of $node->language, since the node reference field may have multiple languages. Because multiple languages for a node reference may be rare, I left complete support for multiple languages for a later date.
Comment | File | Size | Author |
---|---|---|---|
#3 | node_export_relation-language-fix-1549904-5925196.patch | 1.22 KB | hedinfaok |
node_export_relation-language-fix.patch | 1.14 KB | hedinfaok |
Comments
Comment #1
danielb CreditAttribution: danielb commentedI have committed your patch. Thanks.
If you think there is more to do please start a new thread. However, from my understanding of http://api.drupal.org/api/drupal/modules%21field%21field.multilingual.in... when the third parameter is supplied (as is the case in your patch) we never get an array of languages, only one language (or FALSE if no language exists - though I can't imagine how that would happen since 'und' is used by default).
Comment #2
danielb CreditAttribution: danielb commentedactually if you don't disagree with what i've said, perhaps we should remove the TODO ?
Comment #3
hedinfaok CreditAttribution: hedinfaok commentedYou are absolutely correct, an array will not be returned in this case. I pulled and created another patch.
BTW, thanks for making it easy to contribute on this one.
Comment #4
danielb CreditAttribution: danielb commentedCheers. Patch seems to be diffed in reverse so I applied the changes manually.
Comment #5
hedinfaok CreditAttribution: hedinfaok commentedAch, stupid mistake. Thanks again.