W3cubDocs

/Drupal 8

protected function ConfigImporter::importConfig

protected ConfigImporter::importConfig($collection, $op, $name)

Writes a configuration change from the source to the target storage.

Parameters

string $collection: The configuration collection.

string $op: The change operation.

string $name: The name of the configuration to process.

File

core/lib/Drupal/Core/Config/ConfigImporter.php, line 900

Class

ConfigImporter
Defines a configuration importer.

Namespace

Drupal\Core\Config

Code

protected function importConfig($collection, $op, $name) {
  // Allow config factory overriders to use a custom configuration object if
  // they are responsible for the collection.
  $overrider = $this->configManager->getConfigCollectionInfo()->getOverrideService($collection);
  if ($overrider) {
    $config = $overrider->createConfigObject($name, $collection);
  }
  else {
    $config = new Config($name, $this->storageComparer->getTargetStorage($collection), $this->eventDispatcher, $this->typedConfigManager);
  }
  if ($op == 'delete') {
    $config->delete();
  }
  else {
    $data = $this->storageComparer->getSourceStorage($collection)->read($name);
    $config->setData($data ? $data : array());
    $config->save();
  }
  $this->setProcessedConfiguration($collection, $op, $name);
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Config!ConfigImporter.php/function/ConfigImporter::importConfig/8.1.x