You are here

function taxonomy_configuration_rebuild in Configuration Management 7

Implements hook_configuration_rebuild().

Rebuilds Taxonomy vocabularies from code defaults.

1 call to taxonomy_configuration_rebuild()
taxonomy_configuration_revert in includes/configuration.taxonomy.inc
Implements hook_configuration_revert().

File

includes/configuration.taxonomy.inc, line 91

Code

function taxonomy_configuration_rebuild($identifiers, $module_name = 'configuration') {
  if ($vocabularies = configuration_get_default('taxonomy', $module_name)) {
    $existing = taxonomy_get_vocabularies();
    foreach ($vocabularies as $vocabulary) {
      if (in_array($vocabulary['machine_name'], $identifiers) || !empty($identifiers) && $identifiers[0] == '#import_all') {
        $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);
      }
    }
  }
}