You are here

function uuid_node_features_export in UUID Features Integration 7

Same name and namespace in other branches
  1. 6 includes/uuid_node.features.inc \uuid_node_features_export()

Implements hook_features_export().

File

includes/uuid_node.features.inc, line 45
Features hooks for the uuid_node features component.

Code

function uuid_node_features_export($data, &$export, $module_name = '') {
  $pipe = array();
  $export['dependencies']['uuid_features'] = 'uuid_features';
  $nids = entity_get_id_by_uuid('node', $data);
  foreach ($nids as $uuid => $nid) {

    // Load the existing node, with a fresh cache.
    $node = node_load($nid, NULL, TRUE);
    entity_make_entity_universal('node', array(
      $node,
    ));
    $export['features']['uuid_node'][$uuid] = $uuid;
    $pipe['node'][$node->type] = $node->type;

    // drupal_alter() normally supports just one byref parameter. Using
    // the __drupal_alter_by_ref key, we can store any additional parameters
    // that need to be altered, and they'll be split out into additional params
    // for the hook_*_alter() implementations.
    $data =& $export;
    $data['__drupal_alter_by_ref']['pipe'] =& $pipe;
    $entity_type = 'node';
    drupal_alter('uuid_entity_features_export', $entity_type, $data, $node, $module);
    drupal_alter('uuid_node_features_export', $data, $node, $module);
    unset($data['__drupal_alter_by_ref']);
  }
  return $pipe;
}