diff --git a/core/config/schema/core.data_types.schema.yml b/core/config/schema/core.data_types.schema.yml index 0e589e1..5bbe16a 100644 --- a/core/config/schema/core.data_types.schema.yml +++ b/core/config/schema/core.data_types.schema.yml @@ -375,7 +375,7 @@ field_config_base: type: boolean label: 'Translatable' default_value: - type: field.[%parent.field_type].value + type: field.[%parent.field_type].single_value default_value_callback: type: string label: 'Default value callback' @@ -414,14 +414,23 @@ core.date_format.*: type: string label: 'Default language' -# Schema for the String field type. +# Schema for the configuration of the String field type. + +field.string.storage_settings: + type: mapping + label: 'String settings' + mapping: + max_length: + type: integer + label: 'Maximum length' field.string.field_settings: type: sequence label: 'String settings' - sequence: - - type: string - label: 'Setting' + +field.string.single_value: + type: string + label: 'Value' field.string.value: type: sequence @@ -431,10 +440,144 @@ field.string.value: label: 'Default' mapping: value: - type: string - label: 'Value' + type: field.string.single_value + +# Schema for the configuration of the String (long) field type. + +field.string_long.storage_settings: + type: field.string.storage_settings + label: 'String (long) settings' + +field.string_long.field_settings: + type: field.string.field_settings + label: 'String (long) settings' + +field.string_long.single_value: + type: text + label: 'Value' + +field.string_long.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default' + mapping: + value: + type: field.string_long.single_value + +# Schema for the configuration of the URI field type. + +field.uri.storage_settings: + type: mapping + label: 'URI settings' + mapping: + max_length: + type: integer + label: 'Maximum length' + +field.uri.field_settings: + type: sequence + label: 'URI settings' + +field.uri.single_value: + type: string + label: 'Value' + +field.uri.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default' + mapping: + value: + type: field.uri.single_value + +# Schema for the configuration of the Created field type. + +field.created.storage_settings: + type: sequence + label: 'Created timestamp settings' + +field.created.field_settings: + type: sequence + label: 'Created timestamp settings' + +field.created.single_value: + type: integer + label: 'Value' + +field.created.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default' + mapping: + value: + type: field.created.single_value + +# Schema for the configuration of the Changed field type. -# Schema for the configuration files of the Boolean field type. +field.changed.storage_settings: + type: sequence + label: 'Changed timestamp settings' + +field.changed.field_settings: + type: sequence + label: 'Changed timestamp settings' + +field.changed.single_value: + type: integer + label: 'Value' + +field.changed.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default' + mapping: + value: + type: field.changed.single_value + +# Schema for the configuration of the Entity reference field type. + +field.entity_reference.storage_settings: + type: mapping + label: 'Entity reference settings' + mapping: + target_type: + type: string + label: 'Type of item to reference' + +field.entity_reference.field_settings: + type: mapping + label: 'Entity reference settings' + mapping: + handler: + type: string + label: 'Reference method' + handler_settings: + type: entity_reference.[%parent.handler].handler_settings + label: 'Reference method settings' + +field.entity_reference.single_value: + type: integer + label: 'Value' + +field.entity_reference.value: + type: sequence + label: 'Default value' + sequence: + - type: mapping + label: 'Default' + mapping: + target_id: + type: field.entity_reference.single_value + +# Schema for the configuration of the Boolean field type. field.boolean.storage_settings: type: mapping @@ -449,8 +592,11 @@ field.boolean.storage_settings: field.boolean.field_settings: label: 'Boolean settings' - type: mapping - mapping: { } + type: sequence + +field.boolean.single_value: + type: boolean + label: 'Value' field.boolean.value: type: sequence @@ -460,10 +606,9 @@ field.boolean.value: label: 'Default' mapping: value: - type: integer - label: 'Value' + type: field.boolean.single_value -# Schema for the configuration files of the Email field type. +# Schema for the configuration of the Email field type. field.email.storage_settings: type: sequence @@ -478,6 +623,10 @@ field.email.field_settings: - type: string label: 'Setting' +field.email.single_value: + type: email + label: 'Value' + field.email.value: type: sequence label: 'Default value' @@ -486,10 +635,9 @@ field.email.value: label: 'Default' mapping: value: - type: email - label: 'Value' + type: field.email.single_value -# Schema for configuration files of a numeric field types. +# Schema for the configuration of the Integer field type. field.integer.storage_settings: type: sequence @@ -515,6 +663,10 @@ field.integer.field_settings: type: string label: 'Suffix' +field.integer.single_value: + type: integer + label: 'Value' + field.integer.value: type: sequence label: 'Default value' @@ -523,8 +675,9 @@ field.integer.value: label: 'Default value' mapping: value: - type: integer - label: 'Value' + type: field.integer.single_value + +# Schema for the configuration of the Decimal field type. field.decimal.storage_settings: type: mapping @@ -554,6 +707,10 @@ field.decimal.field_settings: type: string label: 'Suffix' +field.decimal.single_value: + type: float + label: 'Value' + field.decimal.value: type: sequence label: 'Default value' @@ -562,8 +719,9 @@ field.decimal.value: label: 'Default value' mapping: value: - type: float - label: 'Value' + type: field.decimal.single_value + +# Schema for the configuration of the Float field type. field.float.storage_settings: type: sequence @@ -589,6 +747,10 @@ field.float.field_settings: type: string label: 'Suffix' +field.float.single_value: + type: float + label: 'Value' + field.float.value: type: sequence label: 'Default value' @@ -597,5 +759,4 @@ field.float.value: label: 'Default value' mapping: value: - type: float - label: 'Value' + type: field.float.single_value diff --git a/core/modules/content_translation/config/schema/content_translation.schema.yml b/core/modules/content_translation/config/schema/content_translation.schema.yml index 6e4167e..db56a16 100644 --- a/core/modules/content_translation/config/schema/content_translation.schema.yml +++ b/core/modules/content_translation/config/schema/content_translation.schema.yml @@ -1,5 +1,23 @@ # Schema for the Content Translation module. +# @todo Refactor settings in https://www.drupal.org/node/2363155 +content_translation.settings: + type: sequence + label: 'Entity type' + sequence: + - type: sequence + label: 'Bundle' + - type: mapping + label: 'Settings' + mapping: + content_translation: + type: mapping + label: 'Content translation' + mapping: + enabled: + type: boolean + label: 'Enabled' + field_config.third_party.content_translation: type: mapping label: 'Content translation field settings' diff --git a/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php b/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php index 98ea255..5ca67ab 100644 --- a/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php +++ b/core/modules/content_translation/src/Tests/ContentTranslationSettingsTest.php @@ -8,6 +8,7 @@ namespace Drupal\content_translation\Tests; use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; +use Drupal\config\Tests\SchemaCheckTestTrait; use Drupal\Core\Field\Entity\BaseFieldOverride; use Drupal\Core\Language\Language; use Drupal\field\Entity\FieldConfig; @@ -20,6 +21,8 @@ */ class ContentTranslationSettingsTest extends WebTestBase { + use SchemaCheckTestTrait; + /** * Modules to enable. * @@ -178,6 +181,8 @@ function testSettingsUI() { $this->assertEqual($definitions['body']->isTranslatable(), $translatable, 'Field translatability correctly switched.'); $this->assertEqual($field->isTranslatable(), $definitions['body']->isTranslatable(), 'Configurable field translatability correctly switched.'); } + + $this->assertAllConfigSchema(); } /** @@ -269,4 +274,18 @@ protected function entityManager() { return $this->container->get('entity.manager'); } + /** + * Asserts all active configuration matches schemas. + */ + protected function assertAllConfigSchema() { + $names = $this->container->get('config.storage')->listAll(); + $factory = $this->container->get('config.factory'); + /** @var \Drupal\Core\Config\TypedConfigManagerInterface $typed_config */ + $typed_config = $this->container->get('config.typed'); + foreach ($names as $name) { + $config = $factory->get($name); + $this->assertConfigSchema($typed_config, $name, $config->get()); + } + } + } diff --git a/core/modules/entity_reference/config/schema/entity_reference.schema.yml b/core/modules/entity_reference/config/schema/entity_reference.schema.yml index de96443..5404963 100644 --- a/core/modules/entity_reference/config/schema/entity_reference.schema.yml +++ b/core/modules/entity_reference/config/schema/entity_reference.schema.yml @@ -1,35 +1,5 @@ # Schema for the configuration files of the Entity Reference module. -field.entity_reference.storage_settings: - type: mapping - label: 'Entity reference settings' - mapping: - target_type: - type: string - label: 'Type of item to reference' - -field.entity_reference.field_settings: - type: mapping - label: 'Entity reference settings' - mapping: - handler: - type: string - label: 'Reference method' - handler_settings: - type: entity_reference.[%parent.handler].handler_settings - label: 'Reference method settings' - -field.entity_reference.value: - type: sequence - label: 'Default value' - sequence: - - type: mapping - label: 'Default' - mapping: - target_id: - type: integer - label: 'Value' - entity_reference.default.handler_settings: type: mapping label: 'View handler settings'