diff --git a/core/config/schema/core.data_types.schema.yml b/core/config/schema/core.data_types.schema.yml index a3b6c62..827fe92 100644 --- a/core/config/schema/core.data_types.schema.yml +++ b/core/config/schema/core.data_types.schema.yml @@ -1,3 +1,23 @@ +# Base types provided by Drupal core. + +# Read https://drupal.org/node/1905070 for more details about configuration +# schema, types and type resolution. + +# Undefined type used by the system to assign to elements at any level where +# configuration schema is not defined. Using explicitly has the same effect as +# not defining schema, so there is no point in doing that. +undefined: + label: 'Undefined' + class: '\Drupal\Core\Config\Schema\Undefined' + +# Explicit type to use when no data typing is possible. Instead of using this +# type, we strongly suggest you use configuration structures that can be +# described with other structural elements of schema, and describe your schema +# with those elements. +ignore: + label: 'Ignore' + class: '\Drupal\Core\Config\Schema\Ignore' + # Basic scalar data types from typed data. boolean: label: 'Boolean' @@ -18,23 +38,13 @@ uri: label: 'Uri' class: '\Drupal\Core\TypedData\Plugin\DataType\Uri' -# Undefined type to use for missing schema, don't use explicitly. -undefined: - label: 'Undefined' - class: '\Drupal\Core\Config\Schema\Undefined' - -# Explicit type when no data typing is possible. Avoid if at all possible. -ignore: - label: 'Ignore' - class: '\Drupal\Core\Config\Schema\Ignore' - -# Container data types with lists with known and uknown keys. -sequence: - label: Sequence - class: '\Drupal\Core\Config\Schema\Sequence' +# Container data types for lists with known and unknown keys. mapping: label: Mapping class: '\Drupal\Core\Config\Schema\Mapping' +sequence: + label: Sequence + class: '\Drupal\Core\Config\Schema\Sequence' # Simple extended data types: @@ -61,6 +71,11 @@ date_format: label: 'PHP date format' translatable: true +# HTML color value. +color_hex: + type: string + label: 'Color' + # Complex extended data types: # Mail text with subject and body parts. @@ -196,11 +211,6 @@ route: - type: string label: 'Param' -# HTML color value. -color_hex: - type: string - label: 'Color' - # Config dependencies. config_dependencies: type: mapping diff --git a/core/lib/Drupal/Core/Config/StorableConfigBase.php b/core/lib/Drupal/Core/Config/StorableConfigBase.php index e5b313d..9c0fba8 100644 --- a/core/lib/Drupal/Core/Config/StorableConfigBase.php +++ b/core/lib/Drupal/Core/Config/StorableConfigBase.php @@ -174,8 +174,10 @@ protected function castValue($key, $value) { $element = $this->getSchemaWrapper()->get($key); } catch (SchemaIncompleteException $e) { - // @todo throw an exception due to an incomplete schema. - // Fix as part of https://drupal.org/node/2183983. + // @todo Consider making schema handling more strict by throwing + // SchemaIncompleteException for all incomplete schema conditions *and* + // throwing it forward. See https://drupal.org/node/2183983. + // Until then, we need to handle the Undefined case below. } // Do not cast value if it is unknown or defined to be ignored. if ($element && ($element instanceof Undefined || $element instanceof Ignore)) {