You are here

function taxonomy_features_export in Features 7

Same name and namespace in other branches
  1. 6 includes/features.taxonomy.inc \taxonomy_features_export()
  2. 7.2 includes/features.taxonomy.inc \taxonomy_features_export()

Implements hook_features_export().

@todo Test adding existing dependencies.

File

includes/features.taxonomy.inc, line 33

Code

function taxonomy_features_export($data, &$export, $module_name = '') {
  $pipe = array();

  // taxonomy_default_vocabularies integration is provided by Features.
  $export['dependencies']['features'] = 'features';
  $export['dependencies']['taxonomy'] = 'taxonomy';

  // Add dependencies for each vocabulary.
  $map = features_get_default_map('taxonomy');
  foreach ($data as $machine_name) {
    if (isset($map[$machine_name]) && $map[$machine_name] != $module_name) {
      $export['dependencies'][$map[$machine_name]] = $map[$machine_name];
    }
    else {
      $export['features']['taxonomy'][$machine_name] = $machine_name;
      $fields = field_info_instances('taxonomy_term', $machine_name);
      foreach ($fields as $name => $field) {
        $pipe['field'][] = "taxonomy_term-{$field['bundle']}-{$field['field_name']}";
      }
    }
  }
  return $pipe;
}