function ConfigBase::setData

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Config/ConfigBase.php \Drupal\Core\Config\ConfigBase::setData()
  2. 10 core/lib/Drupal/Core/Config/ConfigBase.php \Drupal\Core\Config\ConfigBase::setData()
  3. 11.x core/lib/Drupal/Core/Config/ConfigBase.php \Drupal\Core\Config\ConfigBase::setData()

Replaces the data of this configuration object.

Parameters

array $data: The new configuration data.

Return value

$this The configuration object.

Throws

\Drupal\Core\Config\ConfigValueException If any key in $data in any depth contains a dot.

2 calls to ConfigBase::setData()
Config::setData in core/lib/Drupal/Core/Config/Config.php
Replaces the data of this configuration object.
ConfigBase::merge in core/lib/Drupal/Core/Config/ConfigBase.php
Merges data into a configuration object.
1 method overrides ConfigBase::setData()
Config::setData in core/lib/Drupal/Core/Config/Config.php
Replaces the data of this configuration object.

File

core/lib/Drupal/Core/Config/ConfigBase.php, line 159

Class

ConfigBase
Provides a base class for configuration objects with get/set support.

Namespace

Drupal\Core\Config

Code

public function setData(array $data) {
    $data = $this->castSafeStrings($data);
    $this->validateKeys($data);
    $this->data = $data;
    return $this;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.