diff -u b/core/modules/language/config/language.types.yml b/core/modules/language/config/language.types.yml --- b/core/modules/language/config/language.types.yml +++ b/core/modules/language/config/language.types.yml @@ -4,7 +4,7 @@ - language_url configurable: - language_interface -settings: +negotiation: language_content: enabled: language-interface: 0 diff -u b/core/modules/language/config/schema/language.schema.yml b/core/modules/language/config/schema/language.schema.yml --- b/core/modules/language/config/schema/language.schema.yml +++ b/core/modules/language/config/schema/language.schema.yml @@ -1,18 +1,18 @@ # Schema for the configuration files of the Language module. -language_type_setting: +language_type_negotiation: type: mapping - label: 'Language type setting' + label: 'Language negotiation per type setting' mapping: enabled: type: sequence - label: 'Enabled methods' + label: 'Enabled negotiators' sequence: - type: integer label: Weight method_weights: type: sequence - label: 'Method weights' + label: 'Negotiator weights' sequence: - type: integer label: Weight @@ -33,12 +33,12 @@ sequence: - type: string label: 'Language type' - settings: + negotiation: type: sequence - label: 'Language type settings' + label: 'Language negotiation per type settings' sequence: - - type: language_type_setting - label: 'Language type setting' + - type: language_type_negotiation + label: 'Language negotiation per type setting' language.negotiation: type: mapping diff -u b/core/modules/language/lib/Drupal/language/Form/NegotiationConfigureForm.php b/core/modules/language/lib/Drupal/language/Form/NegotiationConfigureForm.php --- b/core/modules/language/lib/Drupal/language/Form/NegotiationConfigureForm.php +++ b/core/modules/language/lib/Drupal/language/Form/NegotiationConfigureForm.php @@ -150,7 +150,7 @@ } $method_weights_type[$type] = $method_weights; - $this->config('language.types')->set('settings.' . $type . '.method_weights', $method_weights_input)->save(); + $this->config('language.types')->set('negotiation.' . $type . '.method_weights', $method_weights_input)->save(); } // Update non-configurable language types and the related language @@ -212,8 +212,8 @@ } $negotiation_info = $form['#language_negotiation_info']; - $enabled_methods = $this->config('language.types')->get('settings.' . $type . '.enabled') ?: array(); - $methods_weight = $this->config('language.types')->get('settings.' . $type . '.method_weights') ?: array(); + $enabled_methods = $this->config('language.types')->get('negotiation.' . $type . '.enabled') ?: array(); + $methods_weight = $this->config('language.types')->get('negotiation.' . $type . '.method_weights') ?: array(); // Add missing data to the methods lists. foreach ($negotiation_info as $method_id => $method) { diff -u b/core/modules/language/lib/Drupal/language/LanguageNegotiator.php b/core/modules/language/lib/Drupal/language/LanguageNegotiator.php --- b/core/modules/language/lib/Drupal/language/LanguageNegotiator.php +++ b/core/modules/language/lib/Drupal/language/LanguageNegotiator.php @@ -138,7 +138,7 @@ if ($this->currentUser && $this->request) { // Execute the language negotiation methods in the order they were set up // and return the first valid language found. - foreach ($this->getEnabledMethods($type) as $method_id => $info) { + foreach ($this->getEnabledNegotiators($type) as $method_id => $info) { if (!isset($this->negotiatedLanguages[$method_id])) { $this->negotiatedLanguages[$method_id] = $this->negotiateLanguage($type, $method_id); } @@ -174,8 +174,8 @@ * @return array * An array of enabled detection methods for the provided language type. */ - protected function getEnabledMethods($type) { - return $this->configFactory->get('language.types')->get('settings.' . $type . '.enabled') ?: array(); + protected function getEnabledNegotiators($type) { + return $this->configFactory->get('language.types')->get('negotiation.' . $type . '.enabled') ?: array(); } /** @@ -221,7 +221,7 @@ public function getNegotiationMethods($type = NULL) { $definitions = $this->negotiatorManager->getDefinitions(); if (isset($type)) { - $enabled_methods = $this->getEnabledMethods($type); + $enabled_methods = $this->getEnabledNegotiators($type); $definitions = array_intersect_key($definitions, $enabled_methods); } return $definitions; @@ -245,7 +245,7 @@ * {@inheritdoc} */ public function getPrimaryNegotiationMethod($type) { - $enabled_methods = $this->getEnabledMethods($type); + $enabled_methods = $this->getEnabledNegotiators($type); return empty($enabled_methods) ? LanguageNegotiatorInterface::METHOD_ID : key($enabled_methods); } @@ -257,8 +257,8 @@ $language_types = !empty($type) ? array($type) : $this->languageManager->getLanguageTypes(); foreach ($language_types as $type) { - $enabled_methods = $this->getEnabledMethods($type); - if (isset($enabled_methods['$method_id'])) { + $enabled_methods = $this->getEnabledNegotiators($type); + if (isset($enabled_methods[$method_id])) { $enabled = TRUE; break; } @@ -291,7 +291,7 @@ unset($enabled_methods[$method_id]); } } - $this->configFactory->get('language.types')->set('settings.' . $type . '.enabled', $enabled_methods)->save(); + $this->configFactory->get('language.types')->set('negotiation.' . $type . '.enabled', $enabled_methods)->save(); } /** @@ -305,7 +305,7 @@ $this->negotiatorManager->clearCachedDefinitions(); $this->languageManager->reset(); foreach ($this->languageManager->getDefinedLanguageTypesInfo() as $type => $info) { - $this->saveConfiguration($type, $this->getEnabledMethods($type)); + $this->saveConfiguration($type, $this->getEnabledNegotiators($type)); } } diff -u b/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php --- b/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageNegotiationInfoTest.php @@ -91,7 +91,7 @@ // negotiation settings with the proper flag enabled. \Drupal::state()->set('language_test.language_negotiation_info_alter', TRUE); $this->languageNegotiationUpdate(); - $negotiation = \Drupal::config('language.types')->get('settings.' . $type . '.enabled') ?: array(); + $negotiation = \Drupal::config('language.types')->get('negotiation.' . $type . '.enabled') ?: array(); $this->assertFalse(isset($negotiation[$interface_method_id]), 'Interface language negotiation method removed from the stored settings.'); $this->assertNoFieldByXPath("//input[@name=\"$form_field\"]", NULL, 'Interface language negotiation method unavailable.'); @@ -131,7 +131,7 @@ // Check that unavailable language negotiation methods are not present in // the negotiation settings. - $negotiation = \Drupal::config('language.types')->get('settings.' . $type . '.enabled') ?: array(); + $negotiation = \Drupal::config('language.types')->get('negotiation.' . $type . '.enabled') ?: array(); $this->assertFalse(isset($negotiation[$test_method_id]), 'The disabled test language negotiation method is not part of the content language negotiation settings.'); // Check that configuration page presents the correct options and settings. @@ -173,7 +173,7 @@ $configurable = $this->languageManager->getLanguageTypes(); foreach ($this->languageManager->getDefinedLanguageTypesInfo() as $type => $info) { if (!in_array($type, $configurable) && isset($info['fixed'])) { - $negotiation = \Drupal::config('language.types')->get('settings.' . $type . '.enabled') ?: array(); + $negotiation = \Drupal::config('language.types')->get('negotiation.' . $type . '.enabled') ?: array(); $equal = count($info['fixed']) == count($negotiation); while ($equal && list($id) = each($negotiation)) { list(, $info_id) = each($info['fixed']); diff -u b/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php b/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php --- b/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php +++ b/core/modules/language/lib/Drupal/language/Tests/LanguageUILanguageNegotiationTest.php @@ -239,7 +239,7 @@ // Unknown language prefix should return 404. $definitions = \Drupal::languageManager()->getNegotiator()->getNegotiationMethods(); \Drupal::config('language.types') - ->set('settings.' . Language::TYPE_INTERFACE . '.enabled', array_flip(array_keys($definitions))) + ->set('negotiation.' . Language::TYPE_INTERFACE . '.enabled', array_flip(array_keys($definitions))) ->save(); $this->drupalGet("$langcode_unknown/admin/config", array(), $http_header_browser_fallback); $this->assertResponse(404, "Unknown language path prefix should return 404");