You are here

function nodereference_uuid_node_features_export_render_alter in UUID Features Integration 6

Same name and namespace in other branches
  1. 7 includes/modules/nodereference.inc \nodereference_uuid_node_features_export_render_alter()

Implementation of hook_uuid_node_features_export_render_alter().

File

includes/modules/nodereference.inc, line 42
uuid_node hooks on behalf of the nodereference module.

Code

function nodereference_uuid_node_features_export_render_alter(&$export, $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'];
        $export->{$field_name} = array();

        // Loop through all values of the field.
        foreach ($node->{$field_name} as $delta => $data) {
          if (!empty($data['nid'])) {
            $uuid = uuid_get_uuid('node', 'nid', $data['nid']);
            $export->{$field_name}[$delta] = $uuid;
          }
        }
      }
    }
  }
}