function TypedConfigManager::buildDataDefinition
Same name and namespace in other branches
- 8.9.x core/lib/Drupal/Core/Config/TypedConfigManager.php \Drupal\Core\Config\TypedConfigManager::buildDataDefinition()
- 10 core/lib/Drupal/Core/Config/TypedConfigManager.php \Drupal\Core\Config\TypedConfigManager::buildDataDefinition()
- 11.x core/lib/Drupal/Core/Config/TypedConfigManager.php \Drupal\Core\Config\TypedConfigManager::buildDataDefinition()
Overrides TypedConfigManagerInterface::buildDataDefinition
1 call to TypedConfigManager::buildDataDefinition()
- TypedConfigManager::createFromNameAndData in core/
lib/ Drupal/ Core/ Config/ TypedConfigManager.php - Gets typed data for a given configuration name and its values.
File
-
core/
lib/ Drupal/ Core/ Config/ TypedConfigManager.php, line 92
Class
- TypedConfigManager
- Manages config schema type plugins.
Namespace
Drupal\Core\ConfigCode
public function buildDataDefinition(array $definition, $value, $name = NULL, $parent = NULL) {
// Add default values for data type and replace variables.
$definition += [
'type' => 'undefined',
];
$replace = [];
$type = $definition['type'];
if (strpos($type, ']')) {
// Replace variable names in definition.
$replace = is_array($value) ? $value : [];
if (isset($parent)) {
$replace['%parent'] = $parent;
}
if (isset($name)) {
$replace['%key'] = $name;
}
$type = $this->replaceName($type, $replace);
// Remove the type from the definition so that it is replaced with the
// concrete type from schema definitions.
unset($definition['type']);
}
// Add default values from type definition.
$definition += $this->getDefinitionWithReplacements($type, $replace);
$data_definition = $this->createDataDefinition($definition['type']);
// Pass remaining values from definition array to data definition.
foreach ($definition as $key => $value) {
if (!isset($data_definition[$key])) {
$data_definition[$key] = $value;
}
}
return $data_definition;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.