From e25a1ec76b8034563522124485b13398477a2745 Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole <catch@35733.no-reply.drupal.org> Date: Wed, 16 Jul 2014 14:27:26 +0100 Subject: [PATCH] =?UTF-8?q?Issue=20#2295737=20by=20G=C3=A1bor=20Hojtsy,=20?= =?UTF-8?q?vijaycs85,=20alexpott:=20Fixed=20Not=20all=20shipped=20configur?= =?UTF-8?q?ation=20passes=20validation=20even=20with=20all=20modules=20ena?= =?UTF-8?q?bled.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/config/schema/core.data_types.schema.yml | 10 ++++++++++ .../Core/Config/Schema/SchemaCheckTrait.php | 5 +++++ .../config/src/Tests/ConfigImportAllTest.php | 14 ++++++++++++++ .../config/schema/entity_reference.schema.yml | 2 +- core/modules/file/config/schema/file.schema.yml | 13 ++++++++++--- .../file/src/Plugin/Field/FieldType/FileItem.php | 4 ++-- .../modules/image/config/schema/image.schema.yml | 16 ++-------------- .../menu_ui/config/schema/menu_ui.schema.yml | 3 +++ ...on.d6_comment_entity_form_display_subject.yml | 2 ++ core/modules/path/config/schema/path.schema.yml | 8 ++++++++ .../shortcut/config/schema/shortcut.schema.yml | 6 ------ .../taxonomy/config/schema/taxonomy.schema.yml | 11 ++++++----- 12 files changed, 63 insertions(+), 31 deletions(-) create mode 100644 core/modules/path/config/schema/path.schema.yml diff --git a/core/config/schema/core.data_types.schema.yml b/core/config/schema/core.data_types.schema.yml index 0c92bdc6e368..fb9aad12b5c0 100644 --- a/core/config/schema/core.data_types.schema.yml +++ b/core/config/schema/core.data_types.schema.yml @@ -329,3 +329,13 @@ display_variant.plugin: uuid: type: string label: 'UUID' + +base_entity_reference_field_settings: + type: mapping + mapping: + target_type: + type: string + label: 'Type of item to reference' + target_bundle: + type: string + label: 'Bundle of item to reference' diff --git a/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php b/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php index 0836eaf96a40..536a4cb6b3a3 100644 --- a/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php +++ b/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php @@ -80,6 +80,11 @@ protected function checkValue($key, $value) { $error_key = $this->configName . ':' . $key; $element = $this->schema->get($key); if ($element instanceof Undefined) { + // @todo Temporary workaround for https://www.drupal.org/node/2224761. + $key_parts = explode('.', $key); + if (array_pop($key_parts) == 'translation_sync' && strpos($this->configName, 'field.') === 0) { + return array(); + } return array($error_key => 'Missing schema.'); } diff --git a/core/modules/config/src/Tests/ConfigImportAllTest.php b/core/modules/config/src/Tests/ConfigImportAllTest.php index 0a7216b5ca17..f1f86c6d2518 100644 --- a/core/modules/config/src/Tests/ConfigImportAllTest.php +++ b/core/modules/config/src/Tests/ConfigImportAllTest.php @@ -18,6 +18,8 @@ */ class ConfigImportAllTest extends ModuleTestBase { + use SchemaCheckTestTrait; + /** * The profile to install as a basis for testing. * @@ -118,5 +120,17 @@ public function testInstallUninstall() { $this->container->get('config.manager') ); $this->assertIdentical($storage_comparer->createChangelist()->getChangelist(), $storage_comparer->getEmptyChangelist()); + + // Now we have all configuration imported, test all of them for schema + // conformance. Ensures all imported default configuration is valid when + // all modules are enabled. + $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 423dbc3f5851..242faf31a09a 100644 --- a/core/modules/entity_reference/config/schema/entity_reference.schema.yml +++ b/core/modules/entity_reference/config/schema/entity_reference.schema.yml @@ -2,7 +2,7 @@ field.entity_reference.settings: type: mapping - label: 'Settings' + label: 'Entity reference settings' mapping: target_type: type: string diff --git a/core/modules/file/config/schema/file.schema.yml b/core/modules/file/config/schema/file.schema.yml index 0fb20de71922..08634ddd1482 100644 --- a/core/modules/file/config/schema/file.schema.yml +++ b/core/modules/file/config/schema/file.schema.yml @@ -23,7 +23,7 @@ file.settings: label: 'Directory' field.file.settings: - type: mapping + type: base_entity_reference_field_settings label: 'File settings' mapping: display_field: @@ -43,10 +43,12 @@ field.file.value: - type: string label: 'Value' -field.file.instance_settings: +base_file_field_instance_settings: type: mapping - label: 'File settings' mapping: + handler: + type: string + label: 'Reference method' file_directory: type: string label: 'File directory' @@ -56,6 +58,11 @@ field.file.instance_settings: max_filesize: type: string label: 'Maximum upload size' + +field.file.instance_settings: + type: base_file_field_instance_settings + label: 'File settings' + mapping: description_field: type: boolean label: 'Enable Description field' diff --git a/core/modules/file/src/Plugin/Field/FieldType/FileItem.php b/core/modules/file/src/Plugin/Field/FieldType/FileItem.php index 6af6741987aa..a56448a457f9 100644 --- a/core/modules/file/src/Plugin/Field/FieldType/FileItem.php +++ b/core/modules/file/src/Plugin/Field/FieldType/FileItem.php @@ -32,8 +32,8 @@ class FileItem extends EntityReferenceItem { public static function defaultSettings() { return array( 'target_type' => 'file', - 'display_field' => 0, - 'display_default' => 0, + 'display_field' => FALSE, + 'display_default' => FALSE, 'uri_scheme' => file_default_scheme(), ) + parent::defaultSettings(); } diff --git a/core/modules/image/config/schema/image.schema.yml b/core/modules/image/config/schema/image.schema.yml index 2985696f9f42..4f1fc7919d19 100644 --- a/core/modules/image/config/schema/image.schema.yml +++ b/core/modules/image/config/schema/image.schema.yml @@ -73,29 +73,17 @@ image.settings: label: 'Suppress the itok query string for image derivatives' field.image.settings: - type: mapping + type: field.file.settings label: 'Image settings' mapping: - uri_scheme: - type: string - label: 'Upload destination' default_image: type: field_default_image label: 'Default value' field.image.instance_settings: - type: mapping + type: base_file_field_instance_settings label: 'Image settings' mapping: - file_directory: - type: string - label: 'Upload destination' - file_extensions: - type: string - label: 'Allowed file extensions' - max_filesize: - type: string - label: 'Maximum upload size' max_resolution: type: string label: 'Maximum image resolution' diff --git a/core/modules/menu_ui/config/schema/menu_ui.schema.yml b/core/modules/menu_ui/config/schema/menu_ui.schema.yml index ce6be8b9d611..7625f0d96628 100644 --- a/core/modules/menu_ui/config/schema/menu_ui.schema.yml +++ b/core/modules/menu_ui/config/schema/menu_ui.schema.yml @@ -24,3 +24,6 @@ menu.entity.node.*: sequence: - type: string label: 'Menu machine name' + parent: + type: string + label: 'Parent' diff --git a/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_entity_form_display_subject.yml b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_entity_form_display_subject.yml index e59767da218d..54efa181a01c 100644 --- a/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_entity_form_display_subject.yml +++ b/core/modules/migrate_drupal/config/install/migrate.migration.d6_comment_entity_form_display_subject.yml @@ -1,5 +1,7 @@ id: d6_comment_entity_form_display_subject label: Drupal 6 comment subject form display configuration +migration_groups: + - Drupal 6 source: plugin: d6_comment_variable_per_comment_type constants: diff --git a/core/modules/path/config/schema/path.schema.yml b/core/modules/path/config/schema/path.schema.yml new file mode 100644 index 000000000000..f595e4b351af --- /dev/null +++ b/core/modules/path/config/schema/path.schema.yml @@ -0,0 +1,8 @@ +# Schema for the configuration files of the Path module. + +entity_form_display.field.path: + type: entity_field_form_display_base + label: 'Link format settings' + mapping: + settings: + type: sequence diff --git a/core/modules/shortcut/config/schema/shortcut.schema.yml b/core/modules/shortcut/config/schema/shortcut.schema.yml index daef43433517..93326994ad2b 100644 --- a/core/modules/shortcut/config/schema/shortcut.schema.yml +++ b/core/modules/shortcut/config/schema/shortcut.schema.yml @@ -10,9 +10,3 @@ shortcut.set.*: label: type: label label: 'Label' - links: - type: sequence - label: 'Shortcuts' - sequence: - - type: string - label: 'Shortcut' diff --git a/core/modules/taxonomy/config/schema/taxonomy.schema.yml b/core/modules/taxonomy/config/schema/taxonomy.schema.yml index c3d0bd40c6c3..40004c3e3e60 100644 --- a/core/modules/taxonomy/config/schema/taxonomy.schema.yml +++ b/core/modules/taxonomy/config/schema/taxonomy.schema.yml @@ -35,7 +35,7 @@ taxonomy.vocabulary.*: label: 'Weight' field.taxonomy_term_reference.settings: - type: mapping + type: base_entity_reference_field_settings label: 'Taxonomy term reference settings' mapping: options_list_callback: @@ -56,11 +56,12 @@ field.taxonomy_term_reference.settings: value: 'Parent' field.taxonomy_term_reference.instance_settings: - type: sequence + type: mapping label: 'Taxonomy term reference settings' - sequence: - - type: string - label: 'Setting' + mapping: + handler: + type: string + label: 'Reference method' field.taxonomy_term_reference.value: type: sequence -- GitLab