diff --git a/core/lib/Drupal/Core/Config/TypedConfigManager.php b/core/lib/Drupal/Core/Config/TypedConfigManager.php index 5c7aeeb..6ccf8fd 100644 --- a/core/lib/Drupal/Core/Config/TypedConfigManager.php +++ b/core/lib/Drupal/Core/Config/TypedConfigManager.php @@ -107,9 +107,13 @@ public function buildDataDefinition(array $definition, $value, $name = NULL, $pa // Remove the type from the definition so that it is replaced with the // concrete type from schema definitions. unset($definition['type']); + + $definition += $this->getDefinition($type, TRUE, $replace); + } + else { + // Add default values from type definition. + $definition += $this->getDefinition($type); } - // Add default values from type definition. - $definition += $this->getDefinition($type); $data_definition = $this->createDataDefinition($definition['type']); @@ -125,7 +129,7 @@ public function buildDataDefinition(array $definition, $value, $name = NULL, $pa /** * {@inheritdoc} */ - public function getDefinition($base_plugin_id, $exception_on_invalid = TRUE) { + public function getDefinition($base_plugin_id, $exception_on_invalid = TRUE, $value = NULL) { $definitions = $this->getDefinitions(); if (isset($definitions[$base_plugin_id])) { $type = $base_plugin_id; @@ -145,6 +149,14 @@ public function getDefinition($base_plugin_id, $exception_on_invalid = TRUE) { // Preserve integer keys on merge, so sequence item types can override // parent settings as opposed to adding unused second, third, etc. items. $definition = NestedArray::mergeDeepArray(array($merge, $definition), TRUE); + + // If the sub type has a bracket then lets look that up as well. + if (isset($value) && strpos($definition['type'], ']')) { + $sub_type = $this->replaceName($definition['type'], $value); + $merge = $definitions[$sub_type]; + $definition = NestedArray::mergeDeepArray(array($merge, $definition), TRUE); + } + // Unset type so we try the merge only once per type. unset($definition['type']); $this->definitions[$type] = $definition;