function nodereference_uuid_node_features_rebuild_alter in UUID Features Integration 7
Same name and namespace in other branches
- 6 includes/modules/nodereference.inc \nodereference_uuid_node_features_rebuild_alter()
Implements hook_uuid_node_features_rebuild_alter().
Replace noderef uuid's with a field array suitable for node_save().
File
- includes/
modules/ nodereference.inc, line 70 - uuid_node hooks on behalf of the nodereference module.
Code
function nodereference_uuid_node_features_rebuild_alter(&$node, $module) {
$types = content_types();
if (!empty($types[$node->type])) {
// Find CCK nodereference fields.
foreach ($types[$node->type]['fields'] as $field) {
if ($field['module'] == 'nodereference') {
$field_name = $field['field_name'];
// Loop through all values of the field.
foreach ($node->{$field_name} as $delta => $uuid) {
$nid = uuid_get_serial_id('node', 'nid', $uuid);
$node->{$field_name}[$delta] = array(
'nid' => $nid,
);
}
}
}
}
}