summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/modules/language/src/Plugin/migrate/process/LanguageDomains.php2
-rw-r--r--core/modules/language/src/Plugin/migrate/source/Language.php2
-rw-r--r--core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php13
3 files changed, 15 insertions, 2 deletions
diff --git a/core/modules/language/src/Plugin/migrate/process/LanguageDomains.php b/core/modules/language/src/Plugin/migrate/process/LanguageDomains.php
index 2fcf7d7..6a3b89e 100644
--- a/core/modules/language/src/Plugin/migrate/process/LanguageDomains.php
+++ b/core/modules/language/src/Plugin/migrate/process/LanguageDomains.php
@@ -20,7 +20,7 @@ class LanguageDomains extends ArrayBuild {
* {@inheritdoc}
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
- if ($row->getSourceProperty('domain_negotiation')) {
+ if ($row->getSourceProperty('domain_negotiation_used')) {
global $base_url;
foreach ($value as $old_key => $old_value) {
diff --git a/core/modules/language/src/Plugin/migrate/source/Language.php b/core/modules/language/src/Plugin/migrate/source/Language.php
index c232675..8e62b23 100644
--- a/core/modules/language/src/Plugin/migrate/source/Language.php
+++ b/core/modules/language/src/Plugin/migrate/source/Language.php
@@ -66,7 +66,7 @@ class Language extends DrupalSqlBase {
// when the 'language_negotiation' variable is set to '3', and in D7, when
// the 'locale_language_negotiation_url_part' variable is set to '1'.
if ($this->variableGet('language_negotiation', 0) == 3 || $this->variableGet('locale_language_negotiation_url_part', 0) == 1) {
- $row->setSourceProperty('domain_negotiation', TRUE);
+ $row->setSourceProperty('domain_negotiation_used', TRUE);
}
}
diff --git a/core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php b/core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php
index fe6296c..9188411 100644
--- a/core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php
+++ b/core/modules/language/tests/src/Kernel/Migrate/d7/MigrateLanguageNegotiationSettingsTest.php
@@ -53,6 +53,10 @@ class MigrateLanguageNegotiationSettingsTest extends MigrateDrupal7TestBase {
* Tests the migration with prefix negotiation.
*/
public function testLanguageNegotiationWithPrefix() {
+ $this->sourceDatabase->update('languages')
+ ->fields(['domain' => ''])
+ ->execute();
+
$this->executeMigrations([
'language',
'd7_language_negotiation_settings',
@@ -68,6 +72,15 @@ class MigrateLanguageNegotiationSettingsTest extends MigrateDrupal7TestBase {
'is' => 'is',
];
$this->assertSame($expected_prefixes, $config->get('url.prefixes'));
+
+ // If prefix negotiation is used, make sure that no domains are migrated.
+ // Otherwise there will be validation errors when trying to save URL
+ // language detection configuration from the UI.
+ $expected_domains = [
+ 'en' => '',
+ 'is' => '',
+ ];
+ $this->assertSame($expected_domains, $config->get('url.domains'));
}
/**