summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2015-05-18 05:22:48 (GMT)
committerAlex Pott2015-05-18 05:22:48 (GMT)
commit9e6958899c420e5ac69096a30ecd9ce7d5514126 (patch)
tree14b60476921ab92fbf6d8dd3cabee587452a3e1f
parentf52cc182358fb786c25e0d6bf02bf6771dceb969 (diff)
Issue #2470307 by Mark_L6n, eiriksm, Gábor Hojtsy: Modifying path prefix for URL language detection causes error message for default language
-rw-r--r--core/modules/language/config/install/language.negotiation.yml1
-rw-r--r--core/modules/language/src/Form/NegotiationUrlForm.php4
-rw-r--r--core/modules/language/src/Tests/LanguageConfigurationTest.php6
3 files changed, 10 insertions, 1 deletions
diff --git a/core/modules/language/config/install/language.negotiation.yml b/core/modules/language/config/install/language.negotiation.yml
index e4e8e22..dde0bea 100644
--- a/core/modules/language/config/install/language.negotiation.yml
+++ b/core/modules/language/config/install/language.negotiation.yml
@@ -6,3 +6,4 @@ url:
en: ''
domains:
en: ''
+selected_langcode: site_default
diff --git a/core/modules/language/src/Form/NegotiationUrlForm.php b/core/modules/language/src/Form/NegotiationUrlForm.php
index 1e3b55d..b304046 100644
--- a/core/modules/language/src/Form/NegotiationUrlForm.php
+++ b/core/modules/language/src/Form/NegotiationUrlForm.php
@@ -153,7 +153,9 @@ class NegotiationUrlForm extends ConfigFormBase {
if (!($default_langcode == $langcode) && $form_state->getValue('language_negotiation_url_part') == LanguageNegotiationUrl::CONFIG_PATH_PREFIX) {
// Throw a form error if the prefix is blank for a non-default language,
// although it is required for selected negotiation type.
- $form_state->setErrorByName("prefix][$langcode", $this->t('The prefix may only be left blank for the selected detection fallback language.'));
+ $form_state->setErrorByName("prefix][$langcode", $this->t('The prefix may only be left blank for the <a href="@url">selected detection fallback language.</a>', [
+ '@url' => $this->getUrlGenerator()->generate('language.negotiation_selected'),
+ ]));
}
}
elseif (strpos($value, '/') !== FALSE) {
diff --git a/core/modules/language/src/Tests/LanguageConfigurationTest.php b/core/modules/language/src/Tests/LanguageConfigurationTest.php
index 025da77..8648328 100644
--- a/core/modules/language/src/Tests/LanguageConfigurationTest.php
+++ b/core/modules/language/src/Tests/LanguageConfigurationTest.php
@@ -91,6 +91,12 @@ class LanguageConfigurationTest extends WebTestBase {
$this->drupalPostForm(NULL, $edit, t('Save configuration'));
$this->assertFieldByXPath('//input[@name="prefix[fr]"]', 'french', 'French path prefix has changed.');
+ // Check that the prefix can be removed.
+ $edit = array(
+ 'prefix[fr]' => '',
+ );
+ $this->drupalPostForm(NULL, $edit, t('Save configuration'));
+ $this->assertNoText(t('The prefix may only be left blank for the selected detection fallback language.'), 'The path prefix can be removed for the default language');
// Change default negotiation language.
$this->config('language.negotiation')->set('selected_langcode', 'fr')->save();