function node_field_copy_node_fields in Node Field 7.2
Copy node fields from one node to another.
Parameters
object $source_node: Node to copy fields from.
object $node: Node to copy fields to.
1 call to node_field_copy_node_fields()
- node_field_node_insert in ./
node_field.module - Implements hook_node_insert().
File
- includes/
node_field.api.inc, line 269 - API and helpers functions for Node Field module.
Code
function node_field_copy_node_fields($source_node, $node) {
$source_node_fields = node_field_get_node_fields($source_node);
if (!empty($source_node_fields)) {
foreach ($source_node_fields as $field) {
$field['id'] = NULL;
$field['nid'] = $node->nid;
node_field_create_node_field($field);
}
}
}