public function ConfigExporter::exportConfiguration in Update helper 8
Same name and namespace in other branches
- 2.x src/ConfigExporter.php \Drupal\update_helper\ConfigExporter::exportConfiguration()
Export configuration.
TODO: It would be good to log that file has been changed!!!
Parameters
\Drupal\update_helper\ConfigName $config_name: Config name.
array $data: Configuration array.
Return value
bool Returns if configuration is stored.
File
- src/
ConfigExporter.php, line 68
Class
- ConfigExporter
- Configuration exporter service.
Namespace
Drupal\update_helperCode
public function exportConfiguration(ConfigName $config_name, array $data) {
$config_full_name = $config_name
->getFullName();
// Check if file with provided config name exists in install or optional
// config and update it accordingly.
foreach ([
$this->extensionConfigStorage,
$this->extensionOptionalConfigStorage,
] as $config_storage) {
$file_data = $config_storage
->read($config_full_name);
if ($file_data) {
$full_file_path = $config_storage
->getFilePath($config_full_name);
return file_put_contents($full_file_path, $this->serializer::encode($data)) !== FALSE;
}
}
return FALSE;
}