You are here

public function ConfigBase::setData in Drupal 10

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Config/ConfigBase.php \Drupal\Core\Config\ConfigBase::setData()
  2. 9 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.

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;
}