diff --git a/core/config/schema/core.data_types.schema.yml b/core/config/schema/core.data_types.schema.yml index faab889..f482e92 100644 --- a/core/config/schema/core.data_types.schema.yml +++ b/core/config/schema/core.data_types.schema.yml @@ -81,6 +81,14 @@ color_hex: # Complex extended data types: +# Root of a configuration object. +config_object: + type: mapping + mapping: + langcode: + type: string + label: 'Language code' + # Mail text with subject and body parts. mail: type: mapping @@ -121,7 +129,7 @@ action_configuration_default: type: string theme_settings: - type: mapping + type: config_object mapping: favicon: type: mapping @@ -255,14 +263,14 @@ config_dependencies: label: 'Enforced configuration dependencies' config_entity: - type: mapping + type: config_object mapping: uuid: type: string label: 'UUID' langcode: type: string - label: 'Default language' + label: 'Language code' status: type: boolean label: 'Status' @@ -416,9 +424,6 @@ core.date_format.*: pattern: type: date_format label: 'PHP date format' - langcode: - type: string - label: 'Default language' # Generic field settings schemas. diff --git a/core/config/schema/core.extension.schema.yml b/core/config/schema/core.extension.schema.yml index f53e5e6..bdc84b9 100644 --- a/core/config/schema/core.extension.schema.yml +++ b/core/config/schema/core.extension.schema.yml @@ -1,5 +1,5 @@ core.extension: - type: mapping + type: config_object label: 'Extension settings' mapping: module: diff --git a/core/config/schema/core.menu.schema.yml b/core/config/schema/core.menu.schema.yml index 069ec19..1a6c268 100644 --- a/core/config/schema/core.menu.schema.yml +++ b/core/config/schema/core.menu.schema.yml @@ -1,5 +1,5 @@ core.menu.static_menu_link_overrides: - type: mapping + type: config_object label: 'Static menu link overrides' mapping: definitions: diff --git a/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php b/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php index 00bbba5..5127adc 100644 --- a/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php +++ b/core/lib/Drupal/Core/Config/Schema/SchemaCheckTrait.php @@ -53,7 +53,7 @@ public function checkConfigSchema(TypedConfigManagerInterface $typed_config, $co if (!$typed_config->hasConfigSchema($config_name)) { return FALSE; } - $definition = $typed_config->getDefinition($config_name, TRUE, TRUE); + $definition = $typed_config->getDefinition($config_name); $data_definition = $typed_config->buildDataDefinition($definition, $config_data); $this->schema = $typed_config->create($data_definition, $config_data); $errors = array(); diff --git a/core/lib/Drupal/Core/Config/StorableConfigBase.php b/core/lib/Drupal/Core/Config/StorableConfigBase.php index d4b1fb1..4af470e 100644 --- a/core/lib/Drupal/Core/Config/StorableConfigBase.php +++ b/core/lib/Drupal/Core/Config/StorableConfigBase.php @@ -128,7 +128,7 @@ public function getStorage() { */ protected function getSchemaWrapper() { if (!isset($this->schemaWrapper)) { - $definition = $this->typedConfigManager->getDefinition($this->name, TRUE, TRUE); + $definition = $this->typedConfigManager->getDefinition($this->name); $data_definition = $this->typedConfigManager->buildDataDefinition($definition, $this->data); $this->schemaWrapper = $this->typedConfigManager->create($data_definition, $this->data); } diff --git a/core/lib/Drupal/Core/Config/TypedConfigManager.php b/core/lib/Drupal/Core/Config/TypedConfigManager.php index a086e34..244747a 100644 --- a/core/lib/Drupal/Core/Config/TypedConfigManager.php +++ b/core/lib/Drupal/Core/Config/TypedConfigManager.php @@ -72,7 +72,7 @@ public function __construct(StorageInterface $configStorage, StorageInterface $s */ public function get($name) { $data = $this->configStorage->read($name); - $type_definition = $this->getDefinition($name, TRUE, TRUE); + $type_definition = $this->getDefinition($name); $data_definition = $this->buildDataDefinition($type_definition, $data); return $this->create($data_definition, $data); } diff --git a/core/lib/Drupal/Core/Config/TypedConfigManagerInterface.php b/core/lib/Drupal/Core/Config/TypedConfigManagerInterface.php index 402cb82..e9e562e 100644 --- a/core/lib/Drupal/Core/Config/TypedConfigManagerInterface.php +++ b/core/lib/Drupal/Core/Config/TypedConfigManagerInterface.php @@ -111,8 +111,8 @@ public function hasConfigSchema($name); * Ignored with TypedConfigManagerInterface. Kept for compatibility with * DiscoveryInterface. * @param bool $is_config_name - * Set to TRUE if $plugin_id is a configuration name (as opposed to an - * internal configuration schema type). + * (deprecated) Set to TRUE if $plugin_id is a configuration name (as + * opposed to an internal configuration schema type). * * @return array * A plugin definition array. If the given plugin id does not have typed diff --git a/core/modules/config/src/Tests/ConfigSchemaTest.php b/core/modules/config/src/Tests/ConfigSchemaTest.php index cf945d9..cf7cc08 100644 --- a/core/modules/config/src/Tests/ConfigSchemaTest.php +++ b/core/modules/config/src/Tests/ConfigSchemaTest.php @@ -101,7 +101,7 @@ function testSchemaMapping() { 'type' => 'text', ); $expected['mapping']['langcode'] = array( - 'label' => 'Default language', + 'label' => 'Language code', 'type' => 'string', ); $expected['type'] = 'system.maintenance'; @@ -156,7 +156,7 @@ function testSchemaMapping() { $expected['mapping']['uuid']['type'] = 'string'; $expected['mapping']['uuid']['label'] = 'UUID'; $expected['mapping']['langcode']['type'] = 'string'; - $expected['mapping']['langcode']['label'] = 'Default language'; + $expected['mapping']['langcode']['label'] = 'Language code'; $expected['mapping']['status']['type'] = 'boolean'; $expected['mapping']['status']['label'] = 'Status'; $expected['mapping']['dependencies']['type'] = 'config_dependencies'; diff --git a/core/modules/config_translation/tests/modules/config_translation_test/config/schema/config_translation_test.schema.yml b/core/modules/config_translation/tests/modules/config_translation_test/config/schema/config_translation_test.schema.yml index a5ff2e6..63b8475 100644 --- a/core/modules/config_translation/tests/modules/config_translation_test/config/schema/config_translation_test.schema.yml +++ b/core/modules/config_translation/tests/modules/config_translation_test/config/schema/config_translation_test.schema.yml @@ -1,7 +1,7 @@ # Schema for the configuration files of the Configuration translation test module. config_translation_test.content: - type: mapping + type: config_object label: 'Content' mapping: id: @@ -10,9 +10,6 @@ config_translation_test.content: label: type: label label: 'Label' - langcode: - type: string - label: 'Default language' content: type: text_format label: 'Content' diff --git a/core/modules/field/config/schema/field.schema.yml b/core/modules/field/config/schema/field.schema.yml index 9ea9b2e..55760a7 100644 --- a/core/modules/field/config/schema/field.schema.yml +++ b/core/modules/field/config/schema/field.schema.yml @@ -1,7 +1,7 @@ # Schema for configuration files of the Field module. field.settings: - type: mapping + type: config_object label: 'Field settings' mapping: purge_batch_size: diff --git a/core/modules/filter/config/schema/filter.schema.yml b/core/modules/filter/config/schema/filter.schema.yml index ac956f7..ab035e1 100644 --- a/core/modules/filter/config/schema/filter.schema.yml +++ b/core/modules/filter/config/schema/filter.schema.yml @@ -35,9 +35,6 @@ filter.format.*: label: 'Enabled filters' sequence: type: filter - langcode: - type: string - label: 'Default language' dependencies: type: config_dependencies label: 'Dependencies' diff --git a/core/modules/language/config/install/language.mappings.yml b/core/modules/language/config/install/language.mappings.yml index f7fc321..5c64193 100644 --- a/core/modules/language/config/install/language.mappings.yml +++ b/core/modules/language/config/install/language.mappings.yml @@ -1,12 +1,13 @@ # Browsers use different language codes to refer to the same languages, # these defaults handles the most common cases. -no: 'nb' # Norwegian -pt: 'pt-pt' # Portuguese -zh: 'zh-hans' # Default Chinese to simplified script -zh-tw: 'zh-hant' # Taiwan Chinese in traditional script -zh-hk: 'zh-hant' # Hong Kong Chinese in traditional script -zh-mo: 'zh-hant' # Macao Chinese in traditional script -zh-cht: 'zh-hant' # traditional Chinese -zh-cn: 'zh-hans' # PRC Mainland Chinese in simplified script -zh-sg: 'zh-hans' # Singapore Chinese in simplified script -zh-chs: 'zh-hans' # simplified Chinese +map: + no: 'nb' # Norwegian + pt: 'pt-pt' # Portuguese + zh: 'zh-hans' # Default Chinese to simplified script + zh-tw: 'zh-hant' # Taiwan Chinese in traditional script + zh-hk: 'zh-hant' # Hong Kong Chinese in traditional script + zh-mo: 'zh-hant' # Macao Chinese in traditional script + zh-cht: 'zh-hant' # traditional Chinese + zh-cn: 'zh-hans' # PRC Mainland Chinese in simplified script + zh-sg: 'zh-hans' # Singapore Chinese in simplified script + zh-chs: 'zh-hans' # simplified Chinese diff --git a/core/modules/language/config/schema/language.schema.yml b/core/modules/language/config/schema/language.schema.yml index 6c082e1..5e3f55b 100644 --- a/core/modules/language/config/schema/language.schema.yml +++ b/core/modules/language/config/schema/language.schema.yml @@ -18,7 +18,7 @@ language_type_negotiation: label: Weight language.types: - type: mapping + type: config_object label: 'Language types' mapping: all: @@ -41,7 +41,7 @@ language.types: label: 'Language negotiation per type setting' language.negotiation: - type: mapping + type: config_object label: 'Language detection methods' mapping: session: @@ -75,11 +75,14 @@ language.negotiation: label: 'Selected language' language.mappings: - type: sequence + type: config_object label: 'Language mapping' - sequence: - type: string - label: 'Language' + mapping: + map: + type: sequence + sequence: + type: string + label: 'Language' language.entity.*: type: config_entity diff --git a/core/modules/language/language.module b/core/modules/language/language.module index ae8c2e2..4e7f017 100644 --- a/core/modules/language/language.module +++ b/core/modules/language/language.module @@ -448,7 +448,7 @@ function language_get_browser_drupal_langcode_mappings() { if ($config->isNew()) { return array(); } - return $config->get(); + return $config->get('map'); } /** diff --git a/core/modules/language/src/Form/NegotiationBrowserDeleteForm.php b/core/modules/language/src/Form/NegotiationBrowserDeleteForm.php index 1dc1447..73e0246 100644 --- a/core/modules/language/src/Form/NegotiationBrowserDeleteForm.php +++ b/core/modules/language/src/Form/NegotiationBrowserDeleteForm.php @@ -71,7 +71,7 @@ public function buildForm(array $form, FormStateInterface $form_state, $browser_ */ public function submitForm(array &$form, FormStateInterface $form_state) { $this->config('language.mappings') - ->clear($this->browserLangcode) + ->clear('map.' . $this->browserLangcode) ->save(); $args = array( diff --git a/core/modules/language/src/Form/NegotiationBrowserForm.php b/core/modules/language/src/Form/NegotiationBrowserForm.php index 14ebb62..bf0ce4e 100644 --- a/core/modules/language/src/Form/NegotiationBrowserForm.php +++ b/core/modules/language/src/Form/NegotiationBrowserForm.php @@ -180,7 +180,7 @@ public function submitForm(array &$form, FormStateInterface $form_state) { $mappings = $form_state->get('mappings'); if (!empty($mappings)) { $config = $this->config('language.mappings'); - $config->setData($mappings); + $config->setData(['map' => $mappings]); $config->save(); } @@ -198,7 +198,7 @@ protected function language_get_browser_drupal_langcode_mappings() { if ($config->isNew()) { return array(); } - return $config->get(); + return $config->get('map'); } } diff --git a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationBrowser.php b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationBrowser.php index e9fc38e..9acd295 100644 --- a/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationBrowser.php +++ b/core/modules/language/src/Plugin/LanguageNegotiation/LanguageNegotiationBrowser.php @@ -39,7 +39,7 @@ public function getLangcode(Request $request = NULL) { if ($this->languageManager && $request && $request->server->get('HTTP_ACCEPT_LANGUAGE')) { $http_accept_language = $request->server->get('HTTP_ACCEPT_LANGUAGE'); $langcodes = array_keys($this->languageManager->getLanguages()); - $mappings = $this->config->get('language.mappings')->get(); + $mappings = $this->config->get('language.mappings')->get('map'); $langcode = UserAgent::getBestMatchingLangcode($http_accept_language, $langcodes, $mappings); } diff --git a/core/modules/locale/src/LocaleConfigManager.php b/core/modules/locale/src/LocaleConfigManager.php index 17d1e8f..d10cf18 100644 --- a/core/modules/locale/src/LocaleConfigManager.php +++ b/core/modules/locale/src/LocaleConfigManager.php @@ -134,7 +134,7 @@ public function getTranslatableDefaultConfig($name) { if ($this->isSupported($name)) { // Create typed configuration wrapper based on install storage data. $data = $this->installStorageRead($name); - $type_definition = $this->typedConfigManager->getDefinition($name, TRUE, TRUE); + $type_definition = $this->typedConfigManager->getDefinition($name); $data_definition = $this->typedConfigManager->buildDataDefinition($type_definition, $data); $typed_config = $this->typedConfigManager->create($data_definition, $data); if ($typed_config instanceof TraversableTypedDataInterface) { diff --git a/core/modules/locale/tests/modules/locale_test/config/schema/locale_test.schema.yml b/core/modules/locale/tests/modules/locale_test/config/schema/locale_test.schema.yml index daf3391..f6cf7b9 100644 --- a/core/modules/locale/tests/modules/locale_test/config/schema/locale_test.schema.yml +++ b/core/modules/locale/tests/modules/locale_test/config/schema/locale_test.schema.yml @@ -1,7 +1,7 @@ # Schema for the configuration files of the Locale Test module. locale_test.no_translation: - type: mapping + type: config_object label: 'No traslation settings' mapping: test: @@ -9,11 +9,9 @@ locale_test.no_translation: label: 'Test' # See \Drupal\locale\Tests\LocaleConfigSubscriberTest translatable: true - langcode: - type: string locale_test.translation: - type: mapping + type: config_object label: 'translation settings' mapping: test: @@ -21,5 +19,3 @@ locale_test.translation: label: 'Test' # See \Drupal\locale\Tests\LocaleConfigSubscriberTest translatable: true - langcode: - type: string diff --git a/core/modules/migrate_drupal/config/schema/migrate_drupal.source.schema.yml b/core/modules/migrate_drupal/config/schema/migrate_drupal.source.schema.yml index e43ffe8..578a169 100644 --- a/core/modules/migrate_drupal/config/schema/migrate_drupal.source.schema.yml +++ b/core/modules/migrate_drupal/config/schema/migrate_drupal.source.schema.yml @@ -328,7 +328,7 @@ migrate_entity_constant: label: 'Parent' langcode: type: string - label: 'Type' + label: 'Language code' third_party_settings: type: sequence label: 'Settings' diff --git a/core/modules/system/config/schema/system.schema.yml b/core/modules/system/config/schema/system.schema.yml index ba8fa15..3ba947e 100644 --- a/core/modules/system/config/schema/system.schema.yml +++ b/core/modules/system/config/schema/system.schema.yml @@ -1,7 +1,7 @@ # Schema for the configuration files of the System module. system.site: - type: mapping + type: config_object label: 'Site information' mapping: uuid: @@ -35,9 +35,6 @@ system.site: weight_select_max: type: integer label: 'Weight element maximum value' - langcode: - type: string - label: 'Language code' default_langcode: type: string label: 'Site default language code' @@ -46,18 +43,15 @@ system.site: label: 'Notification email address' system.maintenance: - type: mapping + type: config_object label: 'Maintenance mode' mapping: message: type: text label: 'Message to display when in maintenance mode' - langcode: - type: string - label: 'Default language' system.authorize: - type: mapping + type: config_object label: 'Authorize settings' mapping: filetransfer_default: @@ -65,7 +59,7 @@ system.authorize: label: 'Default file transfer protocol' system.cron: - type: mapping + type: config_object label: 'Cron settings' mapping: threshold: @@ -83,7 +77,7 @@ system.cron: label: 'Requirements error period' system.date: - type: mapping + type: config_object label: 'Date settings' mapping: first_day: @@ -96,9 +90,6 @@ system.date: default: type: string label: 'Default country' - langcode: - type: string - label: 'Default language' timezone: type: mapping label: 'Time zone settings' @@ -121,7 +112,7 @@ system.date: label: 'Remind users at login if their time zone is not set' system.diff: - type: mapping + type: config_object label: 'Diff settings' mapping: context: @@ -136,7 +127,7 @@ system.diff: label: 'Number of trailing lines in a diff' system.filter: - type: mapping + type: config_object label: 'Filter settings' mapping: protocols: @@ -147,7 +138,7 @@ system.filter: label: 'Protocol' system.logging: - type: mapping + type: config_object label: 'Logging settings' mapping: error_level: @@ -155,7 +146,7 @@ system.logging: label: 'Error messages to display' system.performance: - type: mapping + type: config_object label: 'Performance settings' mapping: cache: @@ -220,7 +211,7 @@ system.performance: label: 'Stale file threshold' system.rss: - type: mapping + type: config_object label: 'Feed settings' mapping: channel: @@ -240,12 +231,9 @@ system.rss: view_mode: type: string label: 'Feed content' - langcode: - type: string - label: 'Default language' system.theme: - type: mapping + type: config_object label: 'Theme settings' mapping: admin: @@ -292,7 +280,7 @@ system.action.*: type: action.configuration.[%parent.plugin] system.file: - type: mapping + type: config_object label: 'File system' mapping: allow_insecure_uploads: @@ -313,7 +301,7 @@ system.file: label: 'Maximum age for temporary files' system.image: - type: mapping + type: config_object label: 'Image settings' mapping: toolkit: @@ -321,7 +309,7 @@ system.image: label: 'Toolkit' system.image.gd: - type: mapping + type: config_object label: 'Image settings' mapping: jpeg_quality: @@ -329,7 +317,7 @@ system.image.gd: label: 'JPEG quality' system.mail: - type: mapping + type: config_object label: 'Mail system' mapping: interface: diff --git a/core/modules/user/config/schema/user.schema.yml b/core/modules/user/config/schema/user.schema.yml index 09e5989..9d853c1 100644 --- a/core/modules/user/config/schema/user.schema.yml +++ b/core/modules/user/config/schema/user.schema.yml @@ -1,7 +1,7 @@ # Schema for the configuration files of the User module. user.settings: - type: mapping + type: config_object label: 'User settings' mapping: anonymous: @@ -50,12 +50,9 @@ user.settings: password_strength: type: boolean label: 'Enable password strength indicator' - langcode: - type: string - label: 'Default language' user.mail: - type: mapping + type: config_object label: 'Email settings' mapping: cancel_confirm: @@ -85,12 +82,9 @@ user.mail: status_canceled: type: mail label: 'Account cancelled' - langcode: - type: string - label: 'Default language' user.flood: - type: mapping + type: config_object label: 'User flood settings' mapping: uid_only: