You are here

public function VocabularyConfigurationHandler::writeToDatabase in Configuration Management 7.3

Saves the given configuration into the database.

Parameters

\Configuration\Configuration $configuration: The configuration to be saved.

Overrides ConfigurationHandler::writeToDatabase

File

src/Handlers/VocabularyConfigurationHandler.php, line 52

Class

VocabularyConfigurationHandler

Namespace

Configuration\Handlers

Code

public function writeToDatabase(Configuration $configuration) {
  $name = $this
    ->getInternalId($configuration
    ->getIdentifier());
  $vocabulary = $configuration
    ->getData();
  $existent_vocabulary = $this->configuration_manager
    ->drupal()
    ->taxonomy_vocabulary_machine_name_load($name);
  if (!empty($existent_vocabulary)) {
    $vocabulary->vid = $existent_vocabulary->vid;
  }
  $event = $this
    ->triggerEvent('write_to_database', $configuration);
  $this->configuration_manager
    ->drupal()
    ->taxonomy_vocabulary_save($vocabulary);
}