1 config.inc public Config::save()

Saves the configuration object.

Return value

Config The configuration object.

File

core/includes/config.inc, line 794
This is the API for configuration storage.

Class

Config
Defines the default configuration object.

Code

public function save() {
  // Validate the configuration object name before saving.
  static::validateName($this->name);
  if (!$this->isLoaded) {
    $this->load();
  }
  // Ensure config name is saved in the result.
  $this->data = array_merge(array('_config_name' => $this->name), $this->data);
  $this->storage->write($this->name, $this->data);
  $this->isNew = FALSE;

  // Empty static caches of this config file.
  if ($static = & backdrop_static('config')) {
    foreach ($static as $type => $configs) {
      if (array_key_exists($this->name, $configs)) {
        unset($static[$type][$this->name]);
      }
    }
  }

  return $this;
}