You are here

function uuid_term_features_export in UUID Features Integration 6

Same name and namespace in other branches
  1. 7 includes/uuid_term.features.inc \uuid_term_features_export()

Implementation of hook_features_export().

File

includes/uuid_term.features.inc, line 29
Features hooks for the uuid_term features component.

Code

function uuid_term_features_export($data, &$export, $module_name = '') {
  $pipe = array();
  $export['dependencies']['taxonomy'] = 'taxonomy';
  $export['dependencies']['uuid'] = 'uuid';
  $export['dependencies']['uuid_features'] = 'uuid_features';
  foreach ($data as $uuid) {
    $export['features']['uuid_term'][$uuid] = $uuid;

    // Get the UUID of the term's vocabulary.
    $query = 'SELECT uv.uuid FROM {uuid_term_data} utd
      INNER JOIN {term_data} t ON utd.tid = t.tid
      INNER JOIN {uuid_vocabulary} uv ON t.vid = uv.vid
      WHERE utd.uuid = "%s"';
    $voc_uuid = db_result(db_query($query, $uuid));

    // Add the vocab UUID to the pipe, to be processed by uuid_vocabulary.
    $export['features']['uuid_vocabulary'][$voc_uuid] = $voc_uuid;

    // Get the UUID of the term's parents.
    $tid = uuid_get_serial_id('term_data', 'tid', $uuid);
    $parents = taxonomy_get_parents($tid);
    foreach ($parents as $parent) {
      $parent_uuid = uuid_get_uuid('term_data', 'tid', $parent->tid);
      $export['features']['uuid_term'][$parent_uuid] = $parent_uuid;
    }
  }
  return $pipe;
}