You are here

function taxonomy_features_export_render in Features 7

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

Implements hook_features_export_render().

File

includes/features.taxonomy.inc, line 61

Code

function taxonomy_features_export_render($module, $data) {
  $vocabularies = taxonomy_get_vocabularies();
  $code = array();
  foreach ($data as $machine_name) {
    foreach ($vocabularies as $vocabulary) {
      if ($vocabulary->machine_name == $machine_name) {

        // We don't want to break the entity cache, so we need to clone the
        // vocabulary before unsetting the id.
        $vocabulary = clone $vocabulary;
        unset($vocabulary->vid);
        $code[$machine_name] = $vocabulary;
      }
    }
  }
  $code = "  return " . features_var_export($code, '  ') . ";";
  return array(
    'taxonomy_default_vocabularies' => $code,
  );
}