Skip to content
Snippets Groups Projects
Unverified Commit 37e09ab4 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2985716 by maxocub, masipila: Cannot save language negotiation settings after upgrade

parent 2e716070
No related branches found
No related tags found
No related merge requests found
......@@ -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) {
......
......@@ -66,7 +66,7 @@ public function prepareRow(Row $row) {
// 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);
}
}
......
......@@ -53,6 +53,10 @@ public function testLanguageTypes() {
* 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 @@ public function testLanguageNegotiationWithPrefix() {
'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'));
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment