protected StorableConfigBase::validateValue($key, $value)
Validate the values are allowed data types.
string $key: A string that maps to a key within the configuration data.
string $value: Value to associate with the key.
null
\Drupal\Core\Config\UnsupportedDataTypeConfigException If the value is unsupported in configuration.
protected function validateValue($key, $value) { // Minimal validation. Should not try to serialize resources or non-arrays. if (is_array($value)) { foreach ($value as $nested_value_key => $nested_value) { $this->validateValue($key . '.' . $nested_value_key, $nested_value); } } elseif ($value !== NULL && !is_scalar($value)) { throw new UnsupportedDataTypeConfigException("Invalid data type for config element {$this->getName()}:$key"); } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Config!StorableConfigBase.php/function/StorableConfigBase::validateValue/8.1.x