protected StorableConfigBase::validateValue($key, $value)
Validate the values are allowed data types.
Parameters
string $key: A string that maps to a key within the configuration data.
string $value: Value to associate with the key.
Return value
null
Throws
\Drupal\Core\Config\UnsupportedDataTypeConfigException If the value is unsupported in configuration.
File
- core/lib/Drupal/Core/Config/StorableConfigBase.php, line 152
Class
- StorableConfigBase
- Provides a base class for configuration objects with storage support.
Namespace
Drupal\Core\Config
Code
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");
}
}
Please login to continue.