Drupal - How to update a CCK NodeReference field programmatically?
Posted
by Leszek Laszka
on Stack Overflow
See other posts from Stack Overflow
or by Leszek Laszka
Published on 2010-04-27T17:42:48Z
Indexed on
2010/04/27
17:43 UTC
Read the original article
Hit count: 318
I'm trying to create a node (B type) & assign it to a A type node's CCK nodereference field using node_save() method.
$node_type_A = node_load($some_nid);
$node_type_A->field_type_B_node_ref[]['nid'] = $node_type_B_nid;
$node_type_A = node_submit($node_type_A);
node_save($node_type_A);
As the result, a new B type node will be created, but no reference will be assigned to the A type node. any help would be appreciated.
© Stack Overflow or respective owner