You are here

function uuid_features_features_pipe_taxonomy_alter in UUID Features Integration 7

Implements hook_features_pipe_COMPONENT_alter().

When exporting a vocabulary, include its terms.

File

./uuid_features.module, line 234
UUID Features module allows to export data stored in the db by features.

Code

function uuid_features_features_pipe_taxonomy_alter(&$pipe, $data, $export) {
  if (variable_get('uuid_features_vocabulary_terms', FALSE) == TRUE) {
    if (!is_array($data)) {
      $data = array(
        $data,
      );
    }
    if (empty($pipe['uuid_term'])) {
      $pipe['uuid_term'] = array();
    }
    foreach ($data as $machine_name) {
      if ($vocab = taxonomy_vocabulary_machine_name_load($machine_name)) {
        $export['features']['uuid_term'] = array();
        foreach (taxonomy_get_tree($vocab->vid) as $term) {
          uuid_term_features_get_dependencies($export, $term->uuid, $export['module_name']);
        }
        if (!empty($export['features']['uuid_term'])) {
          $pipe['uuid_term'] = array_merge($pipe['uuid_term'], $export['features']['uuid_term']);
        }
      }
    }
  }
}