You are here

public function VocabularyConfiguration::saveToActiveStore in Configuration Management 7.2

Implements Drupal\configuration\Config\Configuration::saveToActiveStore().

Overrides Configuration::saveToActiveStore

File

lib/Drupal/configuration/Config/VocabularyConfiguration.php, line 108
Definition of Drupal\configuration\Config\VocabularyConfiguration.

Class

VocabularyConfiguration

Namespace

Drupal\configuration\Config

Code

public function saveToActiveStore(ConfigIteratorSettings &$settings) {
  $vocabulary = (object) $this
    ->getData();
  if (!empty($vocabulary->vid)) {
    unset($vocabulary->vid);
  }
  $existing = taxonomy_get_vocabularies();
  foreach ($existing as $existing_vocab) {
    if ($existing_vocab->machine_name === $vocabulary->machine_name) {
      $vocabulary->vid = $existing_vocab->vid;
      break;
    }
  }
  taxonomy_vocabulary_save($vocabulary);
  $settings
    ->addInfo('imported', $this
    ->getUniqueId());
}