diff --git a/core/modules/content_translation/src/Plugin/migrate/source/d7/EntityTranslationSettings.php b/core/modules/content_translation/src/Plugin/migrate/source/d7/EntityTranslationSettings.php index 9719777624671d8e511a69bd82654364958b3088..f35a205ae4b48061efa94dc42d96ff0bcaad7299 100644 --- a/core/modules/content_translation/src/Plugin/migrate/source/d7/EntityTranslationSettings.php +++ b/core/modules/content_translation/src/Plugin/migrate/source/d7/EntityTranslationSettings.php @@ -65,7 +65,10 @@ protected function initializeIterator() { // Find out which vocabulary uses entity translation by looking at the // 'entity_translation_taxonomy' variable. - $vocabularies = array_keys(array_filter($results['entity_translation_taxonomy'])); + $vocabularies = []; + if (isset($results['entity_translation_taxonomy']) && is_array($results['entity_translation_taxonomy'])) { + $vocabularies = array_keys(array_filter($results['entity_translation_taxonomy'])); + } if (in_array('node', $entity_types, TRUE) && !empty($node_types)) { // For each node type that uses entity translation, check if a diff --git a/core/modules/content_translation/tests/src/Kernel/Plugin/migrate/source/d7/EntityTranslationSettingsTest.php b/core/modules/content_translation/tests/src/Kernel/Plugin/migrate/source/d7/EntityTranslationSettingsTest.php index 08f7bc44e9dcd304a47f7d2094bf8a73f3b2192b..db0d33292769047ccac994773534ae01dab6964c 100644 --- a/core/modules/content_translation/tests/src/Kernel/Plugin/migrate/source/d7/EntityTranslationSettingsTest.php +++ b/core/modules/content_translation/tests/src/Kernel/Plugin/migrate/source/d7/EntityTranslationSettingsTest.php @@ -112,6 +112,15 @@ public function providerSource() { ], ]; + // Source data when taxonomy terms are translatable but the + // 'entity_translation_taxonomy' variable is not set. + $tests[3]['source_data']['variable'] = [ + [ + 'name' => 'entity_translation_entity_types', + 'value' => 'a:4:{s:7:"comment";i:0;s:4:"node";i:0;s:13:"taxonomy_term";i:1;s:4:"user";i:0;}', + ], + ]; + // Expected data when there's no entity type that uses entity translation. $tests[0]['expected_data'] = []; @@ -235,6 +244,10 @@ public function providerSource() { ], ]; + // Expected data when taxonomy terms are translatable but the + // 'entity_translation_taxonomy' variable is not set. + $tests[3]['expected_data'] = []; + return $tests; }