You are here

function defaultconfig_component_rebuild_vocabularies in Default config 7

Provision vocabularies.

1 string reference to 'defaultconfig_component_rebuild_vocabularies'
defaultconfig_defaultconfig_components in ./defaultconfig.module
Implements hook_defaultconfig_components().

File

./defaultconfig.module, line 96
main module file.

Code

function defaultconfig_component_rebuild_vocabularies(array $info, $vocabularies, $module = NULL) {
  $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);
  }
}