public function Config::set

Sets value in this config object.

Parameters

string $key: Identifier to store value in config.

string $value: Value to associate with identifier.

Return value

Drupal\Core\Config\Config The configuration object.

File

drupal/core/lib/Drupal/Core/Config/Config.php, line 245
Definition of Drupal\Core\Config\Config.

Class

Config
Defines the default configuration object.

Namespace

Drupal\Core\Config

Code

public function set($key, $value) {

  // Type-cast value into a string.
  $value = $this
    ->castValue($value);

  // The dot/period is a reserved character; it may appear between keys, but
  // not within keys.
  $parts = explode('.', $key);
  if (count($parts) == 1) {
    $this->data[$key] = $value;
  }
  else {
    NestedArray::setValue($this->data, $parts, $value);
  }
  $this
    ->resetOverriddenData();
  return $this;
}