Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ConfigBase.php

function ConfigBase::validateKeys

Validates all keys in a passed in config array structure.

Parameters

array $data: Configuration array structure.

Throws

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

2 calls to ConfigBase::validateKeys()
ConfigBase::set in core/lib/Drupal/Core/Config/ConfigBase.php
Sets a value in this configuration object.
ConfigBase::setData in core/lib/Drupal/Core/Config/ConfigBase.php
Replaces the data of this configuration object.

File

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

Class

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

Namespace

Drupal\Core\Config

Code

protected function validateKeys(array $data) {
    foreach ($data as $key => $value) {
        if (str_contains($key, '.')) {
            throw new ConfigValueException("{$key} key contains a dot which is not supported.");
        }
        if (is_array($value)) {
            $this->validateKeys($value);
        }
    }
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal