public function StoragePhp::getDataToSave in Configuration Management 7.2
Saves the configuration object into the DataStore.
1 call to StoragePhp::getDataToSave()
- StoragePhp::save in lib/
Drupal/ configuration/ Storage/ StoragePhp.php - Saves the configuration object into the DataStore.
2 methods override StoragePhp::getDataToSave()
- StorageCtools::getDataToSave in lib/
Drupal/ configuration/ Storage/ StorageCtools.php - Saves the configuration object into the DataStore.
- StorageEntityApi::getDataToSave in lib/
Drupal/ configuration/ Storage/ StorageEntityApi.php - Saves the configuration object into the DataStore.
File
- lib/
Drupal/ configuration/ Storage/ StoragePhp.php, line 69 - Definition of Drupal\configuration\Storage\StoragePhp.
Class
Namespace
Drupal\configuration\StorageCode
public function getDataToSave() {
$data_is_array = FALSE;
$data_to_export = NULL;
if (is_array($this->data)) {
$data_is_array = TRUE;
$data_to_export = array();
}
else {
$data_to_export = new \StdClass();
}
if (!empty($this->keys_to_export)) {
foreach ($this->keys_to_export as $key) {
if ($data_is_array) {
$data_to_export[$key] = $this->data[$key];
}
else {
$data_to_export->{$key} = $this->data->{$key};
}
}
}
else {
$data_to_export = $this->data;
}
$export = '$api = ' . $this
->export($this->api_version) . ";\n\n";
$export .= '$data = ' . $this
->export($data_to_export) . ";\n\n";
$export .= '$dependencies = ' . $this
->export($this->dependencies) . ";\n\n";
$export .= '$optional = ' . $this
->export($this->optional_configurations) . ";\n\n";
$export .= '$modules = ' . $this
->export($this->required_modules) . ";";
$filename = $this->filename;
$file_contents = "<?php\n/**\n * @file\n * {$filename}\n */\n\n" . $export . "\n";
$this->hash = sha1($file_contents);
return $file_contents;
}