diff -u b/core/modules/menu_link_content/migrations/d6_menu_links_translation.yml b/core/modules/menu_link_content/migrations/d6_menu_links_translation.yml --- b/core/modules/menu_link_content/migrations/d6_menu_links_translation.yml +++ b/core/modules/menu_link_content/migrations/d6_menu_links_translation.yml @@ -2,21 +2,20 @@ label: Menu links migration_tags: - Drupal 6 + - Content source: plugin: d6_menu_link_translation process: id: mlid langcode: language - skip: - plugin: skip_on_empty - method: row - source: migrate + description_untranslated: description + title_untranslated: link_title title: - plugin: callback source: - title_translated - - title_untranslated + - '@title_untranslated' callable: array_filter - plugin: callback @@ -26,7 +25,7 @@ plugin: callback source: - description_translated - - description_untranslated + - '@description_untranslated' callable: array_filter - plugin: callback @@ -38,6 +37,9 @@ migration: d6_menu source: menu_name - + plugin: skip_on_empty + method: row + - plugin: static_map map: management: admin diff -u b/core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php b/core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php --- b/core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php +++ b/core/modules/menu_link_content/src/Plugin/migrate/source/d6/MenuLinkTranslation.php @@ -2,7 +2,7 @@ namespace Drupal\menu_link_content\Plugin\migrate\source\d6; -use Drupal\Component\Utility\Unicode; +use Drupal\migrate\MigrateSkipRowException; use Drupal\migrate\Row; use Drupal\menu_link_content\Plugin\migrate\source\MenuLink; @@ -48,21 +48,16 @@ * {@inheritdoc} */ public function prepareRow(Row $row) { + parent::prepareRow($row); $language = $row->getSourceProperty('language'); $mlid = $row->getSourceProperty('mlid'); - if (empty($this->idMap->lookupDestinationIds(['mlid' => $mlid, 'language' => $language]))) { - $row->setSourceProperty('migrate', TRUE); - } - // Set untranslated values as defaults. - $row->setSourceProperty('title_untranslated', $row->getSourceProperty('link_title')); - $row->setSourceProperty('options', unserialize($row->getSourceProperty('options'))); - $row->setSourceProperty('description_untranslated', Unicode::truncate($row->getSourceProperty('options/attributes/title'), 255)); // Save the translation for this property. $property = $row->getSourceProperty('property'); $row->setSourceProperty($property . '_translated', $row->getSourceProperty('translation')); - // Get the translation for the property not already in the row. + // Get the translation, if one exists, for the property not already in the + // row. $other_property = ($property == 'title') ? 'description' : 'title'; $query = $this->select('i18n_strings', 'i18n') ->fields('i18n', ['lid']) diff -u b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php --- b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php +++ b/core/modules/migrate/src/Plugin/migrate/id_map/Sql.php @@ -563,9 +563,11 @@ $conditions = []; foreach ($this->sourceIdFields() as $field_name => $db_field) { if ($is_associative) { + // Ensure to handle array elements with a NULL value. if (array_key_exists($field_name, $source_id_values)) { // Associative $source_id_values can have fields out of order. if (isset($source_id_values[$field_name])) { + // Only add a condition if the value is not NULL. $conditions[$db_field] = $source_id_values[$field_name]; } unset($source_id_values[$field_name]);