You are here

public function StorageCtools::getDataToSave in Configuration Management 7.2

Saves the configuration object into the DataStore.

Overrides StoragePhp::getDataToSave

File

lib/Drupal/configuration/Storage/StorageCtools.php, line 25
Definition of Drupal\configuration\Storage\StorageCtools.

Class

StorageCtools

Namespace

Drupal\configuration\Storage

Code

public function getDataToSave() {
  $filename = $this->filename;
  ctools_include('export');
  $export = '$api = ' . $this
    ->export($this->api_version) . ";\n\n";
  $export .= '$data = ' . ctools_export_crud_export($this->table, $this->data) . "\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) . ";";
  $file_contents = "<?php\n/**\n * @file\n * {$filename}\n */\n\n" . $export . "\n";
  $this->hash = sha1($file_contents);
  return $file_contents;
}