diff -u b/core/lib/Drupal/Core/Config/Schema/ArrayElement.php b/core/lib/Drupal/Core/Config/Schema/ArrayElement.php --- b/core/lib/Drupal/Core/Config/Schema/ArrayElement.php +++ b/core/lib/Drupal/Core/Config/Schema/ArrayElement.php @@ -116 +116 @@ -} \ No newline at end of file +} diff -u b/core/lib/Drupal/Core/Config/Schema/Element.php b/core/lib/Drupal/Core/Config/Schema/Element.php --- b/core/lib/Drupal/Core/Config/Schema/Element.php +++ b/core/lib/Drupal/Core/Config/Schema/Element.php @@ -7,7 +7,7 @@ namespace Drupal\Core\Config\Schema; -use Drupal\Core\TypedData\Type\TypedData; +use Drupal\Core\TypedData\TypedData; /** * Defines a generic configuration element. @@ -46,8 +46,7 @@ * Create typed config object. */ protected function parseElement($key, $data, $definition) { - $context = array('name' => $key, 'parent' => $this); - return config_typed()->create($definition, $data, $context); + return config_typed()->create($definition, $data, $key, $this); } } diff -u b/core/lib/Drupal/Core/Config/Schema/Mapping.php b/core/lib/Drupal/Core/Config/Schema/Mapping.php --- b/core/lib/Drupal/Core/Config/Schema/Mapping.php +++ b/core/lib/Drupal/Core/Config/Schema/Mapping.php @@ -125 +125 @@ -} \ No newline at end of file +} diff -u b/core/lib/Drupal/Core/Config/Schema/Parser.php b/core/lib/Drupal/Core/Config/Schema/Parser.php --- b/core/lib/Drupal/Core/Config/Schema/Parser.php +++ b/core/lib/Drupal/Core/Config/Schema/Parser.php @@ -15,7 +15,7 @@ /** * Parse configuration data against schema data. */ - static function parse($data, $definition, $context = array()) { + static function parse($data, $definition, $name = NULL, $parent = NULL) { // Set default type depending on data and context. if (!isset($definition['type'])) { if (is_array($data) || !$context) { @@ -26,7 +26,7 @@ } } // Create typed data object. - config_typed()->create($definition, $data, $context); + config_typed()->create($definition, $data, $name, $parent); } /** diff -u b/core/lib/Drupal/Core/Config/Schema/Property.php b/core/lib/Drupal/Core/Config/Schema/Property.php --- b/core/lib/Drupal/Core/Config/Schema/Property.php +++ b/core/lib/Drupal/Core/Config/Schema/Property.php @@ -22 +22 @@ -} \ No newline at end of file +} diff -u b/core/lib/Drupal/Core/Config/Schema/Sequence.php b/core/lib/Drupal/Core/Config/Schema/Sequence.php --- b/core/lib/Drupal/Core/Config/Schema/Sequence.php +++ b/core/lib/Drupal/Core/Config/Schema/Sequence.php @@ -18,7 +18,7 @@ * Overrides ArrayElement::parse() */ protected function parse() { - $definition = $this->definition['sequence'][0]; + $definition = $this->getItemDefinition(); $elements = array(); foreach ($this->value as $key => $value) { $elements[$key] = $this->parseElement($key, $value, $definition); @@ -36 +36,8 @@ -} \ No newline at end of file + /** + * Implements Drupal\Core\TypedData\ListInterface::getItemDefinition(). + */ + public function getItemDefinition() { + return $this->definition['sequence'][0]; + } + +} diff -u b/core/lib/Drupal/Core/Config/TypedConfigManager.php b/core/lib/Drupal/Core/Config/TypedConfigManager.php --- b/core/lib/Drupal/Core/Config/TypedConfigManager.php +++ b/core/lib/Drupal/Core/Config/TypedConfigManager.php @@ -9,7 +9,6 @@ use Drupal\Core\Config\Schema\SchemaDiscovery; use Drupal\Core\TypedData\TypedDataManager; -use Drupal\Core\TypedData\TypedDataFactory; /** * Manages config type plugins. @@ -32,7 +31,7 @@ public function __construct($storage) { $this->storage = $storage; $this->discovery = new SchemaDiscovery($storage); - $this->factory = new TypedDataFactory($this->discovery); + $this->factory = new TypedConfigElementFactory($this->discovery); } /** @@ -55,7 +54,7 @@ * * Fills in default type and does variable replacement. */ - public function create(array $definition, $value = NULL, array $context = array()) { + public function create(array $definition, $value = NULL, $name = NULL, $parent = NULL) { if (!isset($definition['type'])) { // Set default type 'str' if possible. If not it will be 'any'. if (is_string($value)) { @@ -68,14 +67,16 @@ elseif (strpos($definition['type'], ']')) { // Replace variable names in definition. $replace = is_array($value) ? $value : array(); - if ($context) { - $replace['%parent'] = $context['parent']->getValue(); - $replace['%key'] = $context['name']; + if (isset($parent)) { + $replace['%parent'] = $parent->getValue(); + } + if (isset($name)) { + $replace['%key'] = $name; } $definition['type'] = $this->replaceName($definition['type'], $replace); } // Create typed config object. - return parent::create($definition, $value, $context); + return parent::create($definition, $value, $name, $parent); } /** diff -u b/core/modules/contact/config/contact.schema.yml b/core/modules/contact/config/contact.schema.yml --- b/core/modules/contact/config/contact.schema.yml +++ b/core/modules/contact/config/contact.schema.yml @@ -34,2 +34,2 @@ - "user_default_enabled": - type: bool \ No newline at end of file + "user_default_enabled": + type: bool only in patch2: unchanged: --- /dev/null +++ b/core/lib/Drupal/Core/Config/TypedConfigElementFactory.php @@ -0,0 +1,28 @@ +discovery->getDefinition($plugin_id); + $configuration += $type_definition; + return parent::createInstance($plugin_id, $configuration, $name, $parent); + } +}