You are here

function taxonomy_features_rebuild in Features 7

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

Implements hook_features_rebuild().

Rebuilds Taxonomy vocabularies from code defaults.

1 call to taxonomy_features_rebuild()
taxonomy_features_revert in includes/features.taxonomy.inc
Implements hook_features_revert().

File

includes/features.taxonomy.inc, line 91

Code

function taxonomy_features_rebuild($module) {
  if ($vocabularies = features_get_default('taxonomy', $module)) {
    $existing = taxonomy_get_vocabularies();
    foreach ($vocabularies as $vocabulary) {
      $vocabulary = (object) $vocabulary;
      foreach ($existing as $existing_vocab) {
        if ($existing_vocab->machine_name === $vocabulary->machine_name) {
          $vocabulary->vid = $existing_vocab->vid;
        }
      }
      taxonomy_vocabulary_save($vocabulary);
    }
  }
}