Issue #3371828 by quietone: NodeCompleteNodeTranslationLookup should return NULL for non translated lookups

merge-requests/5290/head
Dave Long 2024-01-11 12:11:53 +00:00
parent 528ac5740a
commit c6eb905222
No known key found for this signature in database
GPG Key ID: ED52AE211E142771
2 changed files with 27 additions and 3 deletions

View File

@ -30,6 +30,10 @@ class NodeCompleteNodeTranslationLookup extends ProcessPluginBase {
*/
public function transform($value, MigrateExecutableInterface $migrate_executable, Row $row, $destination_property) {
if (is_array($value) && count($value) === 3) {
// If the language is 'und' then the node was not translated.
if ($value[2] === 'und') {
return NULL;
}
unset($value[1]);
return array_values($value);
}

View File

@ -43,9 +43,6 @@ class MigrateUrlAliasTest extends MigrateDrupal6TestBase {
$this->executeMigrations([
'language',
'd6_node_settings',
'd6_node',
'd6_node_translation',
'd6_url_alias',
]);
}
@ -72,6 +69,29 @@ class MigrateUrlAliasTest extends MigrateDrupal6TestBase {
* Tests the URL alias migration.
*/
public function testUrlAlias() {
$this->executeMigrations([
'd6_node',
'd6_node_translation',
'd6_url_alias',
]);
$this->checkUrlMigration();
}
/**
* Tests the URL alias migration using the node complete migration.
*/
public function testNodeCompleteUrlAlias() {
$this->executeMigrations([
'd6_node_complete',
'd6_url_alias',
]);
$this->checkUrlMigration();
}
/**
* Checks the migration results.
*/
protected function checkUrlMigration() {
$id_map = $this->getMigration('d6_url_alias')->getIdMap();
// Test that the field exists.
$conditions = [