function ConfigImporter::importConfig
Same name in other branches
- 9 core/lib/Drupal/Core/Config/ConfigImporter.php \Drupal\Core\Config\ConfigImporter::importConfig()
- 8.9.x core/lib/Drupal/Core/Config/ConfigImporter.php \Drupal\Core\Config\ConfigImporter::importConfig()
- 10 core/lib/Drupal/Core/Config/ConfigImporter.php \Drupal\Core\Config\ConfigImporter::importConfig()
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.
2 calls to ConfigImporter::importConfig()
- ConfigImporter::processConfiguration in core/
lib/ Drupal/ Core/ Config/ ConfigImporter.php - Processes a configuration change.
- ConfigImporter::processExtension in core/
lib/ Drupal/ Core/ Config/ ConfigImporter.php - Processes an extension change.
File
-
core/
lib/ Drupal/ Core/ Config/ ConfigImporter.php, line 990
Class
- ConfigImporter
- Defines a configuration importer.
Namespace
Drupal\Core\ConfigCode
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 ($old_data = $this->storageComparer
->getTargetStorage($collection)
->read($name)) {
$config->initWithData($old_data);
}
if ($op == 'delete') {
$config->delete();
}
else {
$data = $this->storageComparer
->getSourceStorage($collection)
->read($name);
$config->setData($data ? $data : []);
$config->save();
}
$this->setProcessedConfiguration($collection, $op, $name);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.