You are here

function userreference_uuid_node_features_export_render_alter in UUID Features Integration 7

Same name and namespace in other branches
  1. 6 includes/modules/userreference.inc \userreference_uuid_node_features_export_render_alter()

Implements hook_uuid_node_features_export_render_alter().

File

includes/modules/userreference.inc, line 17
uuid_node hooks on behalf of the userreference module.

Code

function userreference_uuid_node_features_export_render_alter(&$export, $node, $module) {
  $types = content_types();
  if (!empty($types[$node->type])) {

    // Find CCK userreference fields.
    foreach ($types[$node->type]['fields'] as $field) {
      if ($field['module'] == 'userreference') {
        $field_name = $field['field_name'];
        $export->{$field_name} = array();

        // TODO: Use user UUID's instead.
        // If the content type has changed since the last export, this field
        // may not exist.
        if (isset($node->{$field_name})) {

          // Loop through all values of the field.
          foreach ($node->{$field_name} as $delta => $data) {
            $export->{$field_name}[$delta] = array();

            // Save the value of each column.
            foreach ($field['columns'] as $column => $column_data) {
              $export->{$field_name}[$delta][$column] = $data[$column];
            }
          }
        }
      }
    }
  }
}