reverted: --- b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/MenuLinkSourceTranslationTest.php +++ /dev/null @@ -1,256 +0,0 @@ - 'menu-test-menu', - 'mlid' => 138, - 'plid' => 0, - 'link_path' => 'admin', - 'router_path' => 'admin', - 'link_title' => 'Test 1', - 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 1";}}', - 'module' => 'menu', - 'hidden' => 0, - 'external' => 0, - 'has_children' => 1, - 'expanded' => 0, - 'weight' => 15, - 'depth' => 1, - 'customized' => 1, - 'p1' => '138', - 'p2' => '0', - 'p3' => '0', - 'p4' => '0', - 'p5' => '0', - 'p6' => '0', - 'p7' => '0', - 'p8' => '0', - 'p9' => '0', - 'updated' => '0', - 'description' => 'Test menu link 1', - ], - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 139, - 'plid' => 138, - 'link_path' => 'admin/modules', - 'router_path' => 'admin/modules', - 'link_title' => 'Test 2', - 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 2";}}', - 'module' => 'menu', - 'hidden' => 0, - 'external' => 0, - 'has_children' => 0, - 'expanded' => 0, - 'weight' => 12, - 'depth' => 2, - 'customized' => 1, - 'p1' => '138', - 'p2' => '139', - 'p3' => '0', - 'p4' => '0', - 'p5' => '0', - 'p6' => '0', - 'p7' => '0', - 'p8' => '0', - 'p9' => '0', - 'updated' => '0', - 'description' => 'Test menu link 2', - ], - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 140, - 'plid' => 0, - 'link_path' => 'https://www.drupal.org', - 'router_path' => 'admin/modules', - 'link_title' => 'Test 2', - 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 2";}}', - 'module' => 'menu', - 'hidden' => 0, - 'external' => 0, - 'has_children' => 0, - 'expanded' => 0, - 'weight' => 12, - 'depth' => 2, - 'customized' => 1, - 'p1' => '0', - 'p2' => '0', - 'p3' => '0', - 'p4' => '0', - 'p5' => '0', - 'p6' => '0', - 'p7' => '0', - 'p8' => '0', - 'p9' => '0', - 'updated' => '0', - 'description' => 'Test menu link 2', - ], - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 141, - 'plid' => 0, - 'link_path' => 'https://api.drupal.org/api/drupal/8.3.x', - 'router_path' => 'admin/modules', - 'link_title' => 'Test 3', - 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 3";}}', - 'module' => 'menu', - 'hidden' => 0, - 'external' => 0, - 'has_children' => 0, - 'expanded' => 0, - 'weight' => 12, - 'depth' => 2, - 'customized' => 1, - 'p1' => '0', - 'p2' => '0', - 'p3' => '0', - 'p4' => '0', - 'p5' => '0', - 'p6' => '0', - 'p7' => '0', - 'p8' => '0', - 'p9' => '0', - 'updated' => '0', - 'description' => 'Test menu link 3', - ], - ]; - $test[0]['source_data']['i18n_strings'] = [ - [ - 'lid' => 1, - 'objectid' => 139, - 'type' => 'item', - 'property' => 'title', - 'objectindex' => 0, - 'format' => 0, - ], - [ - 'lid' => 2, - 'objectid' => 139, - 'type' => 'item', - 'property' => 'description', - 'objectindex' => 0, - 'format' => 0, - ], - [ - 'lid' => 3, - 'objectid' => 140, - 'type' => 'item', - 'property' => 'description', - 'objectindex' => 0, - 'format' => 0, - ], - [ - 'lid' => 4, - 'objectid' => 141, - 'type' => 'item', - 'property' => 'title', - 'objectindex' => 0, - 'format' => 0, - ], - ]; - $test[0]['source_data']['locales_target'] = [ - [ - 'lid' => 1, - 'language' => 'fr', - 'translation' => 'fr - title translation', - 'plid' => 0, - 'plural' => 0, - 'u18n_status' => 0, - ], - [ - 'lid' => 2, - 'language' => 'fr', - 'translation' => 'fr - description translation', - 'plid' => 0, - 'plural' => 0, - 'u18n_status' => 0, - ], - [ - 'lid' => 3, - 'language' => 'zu', - 'translation' => 'zu - description translation', - 'plid' => 0, - 'plural' => 0, - 'u18n_status' => 0, - ], - [ - 'lid' => 4, - 'language' => 'zu', - 'translation' => 'zu - title translation', - 'plid' => 0, - 'plural' => 0, - 'u18n_status' => 0, - ], - ]; - - $test[0]['expected_results'] = [ - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 139, - 'property' => 'title', - 'language' => 'fr', - 'title_untranslated' => 'Test 2', - 'description_untranslated' => 'Test menu link 2', - 'title_translated' => 'fr - title translation', - 'description_translated' => 'fr - description translation', - - ], - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 139, - 'property' => 'description', - 'language' => 'fr', - 'title_untranslated' => 'Test 2', - 'description_untranslated' => 'Test menu link 2', - 'title_translated' => 'fr - title translation', - 'description_translated' => 'fr - description translation', - ], - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 140, - 'description' => 'Test menu link 2', - 'property' => 'description', - 'language' => 'zu', - 'title_untranslated' => 'Test 2', - 'description_untranslated' => 'Test menu link 2', - 'title_translated' => NULL, - 'description_translated' => 'zu - description translation', - ], - [ - 'menu_name' => 'menu-test-menu', - 'mlid' => 141, - 'property' => 'title', - 'language' => 'zu', - 'title_untranslated' => 'Test 3', - 'description_untranslated' => 'Test menu link 3', - 'title_translated' => 'zu - title translation', - 'description_translated' => NULL, - ], - ]; - - return $test; - } - -} diff -u b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php --- b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php +++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php @@ -322,6 +322,10 @@ 'source_module' => 'i18n', 'destination_module' => 'menu_link_content', ], + 'd6_language_content_menu_settings' => [ + 'source_module' => 'i18n', + 'destination_module' => 'menu_link_content', + ], 'menu_settings' => [ 'source_module' => 'menu', 'destination_module' => 'menu_ui', only in patch2: unchanged: --- /dev/null +++ b/core/modules/language/migration_templates/d6_language_content_menu_settings.yml @@ -0,0 +1,17 @@ +id: d6_language_content_menu_settings +label: Drupal 6 language content settings +migration_tags: + - Drupal 6 +source: + plugin: d6_language_content_menu_settings + constants: + target_type: 'menu_link_content' + langcode: 'site_default' +process: + target_bundle: 'constants/target_type' + target_entity_type_id: 'constants/target_type' + default_langcode: 'constants/site_default' + language_alterable: language_alterable + third_party_settings/content_translation/enabled: enabled +destination: + plugin: entity:language_content_settings only in patch2: unchanged: --- /dev/null +++ b/core/modules/language/src/Plugin/migrate/source/d6/LanguageContentMenuSettings.php @@ -0,0 +1,59 @@ +select('system', 's') + ->fields('s', ['name', 'type', 'status']) + ->condition('name', 'i18nmenu') + ->condition('type', 'module'); + return $query; + } + + /** + * {@inheritdoc} + */ + public function fields() { + $fields = [ + 'name' => $this->t('Name'), + ]; + return $fields; + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + $value = empty($row->getSourceProperty('status')) ? FALSE : TRUE; + $row->setSourceProperty('language_alterable', $value); + $row->setSourceProperty('enabled', $value); + return parent::prepareRow($row); + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['name']['type'] = 'string'; + return $ids; + } + +} only in patch2: unchanged: --- /dev/null +++ b/core/modules/language/tests/src/Kernel/Migrate/d6/MigrateLanguageContentMenuSettingsTest.php @@ -0,0 +1,50 @@ +save(); + ConfigurableLanguage::createFromLangcode('fr')->save(); + $this->executeMigrations(['d6_language_content_menu_settings']); + } + + /** + * Tests migration of menu translation ability. + */ + public function testLanguageMenuContent() { + $config = ContentLanguageSettings::load('menu_link_content.menu_link_content'); + $this->assertTrue($config instanceof ContentLanguageSettings); + + $this->assertSame('menu_link_content', $config->getTargetEntityTypeId()); + $this->assertSame('menu_link_content', $config->getTargetBundle()); + $this->assertSame('site_default', $config->getDefaultLangcode()); + $this->assertTrue($config->getThirdPartySetting('content_translation', 'enabled')); + $this->assertTrue($config->isLanguageAlterable()); + } + +} only in patch2: unchanged: --- /dev/null +++ b/core/modules/language/tests/src/Kernel/Plugin/migrate/source/d6/LanguageContentMenuSettingsTest.php @@ -0,0 +1,65 @@ + 'sites/all/modules/i18n/i18nmenu/i18nmenu.module', + 'name' => 'i18nmenu', + 'type' => 'module', + 'owner' => '', + 'status' => '1', + 'throttle' => '0', + 'bootstrap' => '0', + 'schema_version' => '0', + 'weight' => '0', + 'info' => 'a:10:{s:4:"name";s:16:"Menu translation";s:11:"description";s:40:"Supports translatable custom menu items.";s:12:"dependencies";a:4:{i:0;s:4:"i18n";i:1;s:4:"menu";i:2;s:10:"i18nblocks";i:3;s:11:"i18nstrings";}s:7:"package";s:13:"Multilanguage";s:4:"core";s:3:"6.x";s:7:"version";s:8:"6.x-1.10";s:7:"project";s:4:"i18n";s:9:"datestamp";s:10:"1318336004";s:10:"dependents";a:0:{}s:3:"php";s:5:"4.3.5";},', + ], + [ + 'filename' => 'sites/all/modules/variable/variable.module ', + 'name' => 'variable', + 'type' => 'module', + 'owner' => '', + 'status' => '1', + 'throttle' => '0', + 'bootstrap' => '0', + 'schema_version' => '-1', + 'weight' => '0', + 'info' => 'a:9:{s:4:"name";s:12:"Variable API";s:11:"description";s:12:"Variable API";s:4:"core";s:3:"6.x";s:7:"version";s:14:"6.x-1.0-alpha1";s:7:"project";s:8:"variable";s:9:"datestamp";s:10:"1414059742";s:12:"dependencies";a:0:{}s:10:"dependents";a:0:{}s:3:"php";s:5:"4.3.5";}', + ], + ]; + + $test[0]['expected_results'] = [ + [ + 'name' => 'i18nmenu', + 'status' => '1', + 'language_alterable' => TRUE, + 'enabled' => TRUE, + ], + ]; + + return $test; + } + +} only in patch2: unchanged: --- /dev/null +++ b/core/modules/menu_link_content/tests/src/Kernel/Plugin/migrate/source/d6/MenuLinkTranslationTest.php @@ -0,0 +1,256 @@ + 'menu-test-menu', + 'mlid' => 138, + 'plid' => 0, + 'link_path' => 'admin', + 'router_path' => 'admin', + 'link_title' => 'Test 1', + 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 1";}}', + 'module' => 'menu', + 'hidden' => 0, + 'external' => 0, + 'has_children' => 1, + 'expanded' => 0, + 'weight' => 15, + 'depth' => 1, + 'customized' => 1, + 'p1' => '138', + 'p2' => '0', + 'p3' => '0', + 'p4' => '0', + 'p5' => '0', + 'p6' => '0', + 'p7' => '0', + 'p8' => '0', + 'p9' => '0', + 'updated' => '0', + 'description' => 'Test menu link 1', + ], + [ + 'menu_name' => 'menu-test-menu', + 'mlid' => 139, + 'plid' => 138, + 'link_path' => 'admin/modules', + 'router_path' => 'admin/modules', + 'link_title' => 'Test 2', + 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 2";}}', + 'module' => 'menu', + 'hidden' => 0, + 'external' => 0, + 'has_children' => 0, + 'expanded' => 0, + 'weight' => 12, + 'depth' => 2, + 'customized' => 1, + 'p1' => '138', + 'p2' => '139', + 'p3' => '0', + 'p4' => '0', + 'p5' => '0', + 'p6' => '0', + 'p7' => '0', + 'p8' => '0', + 'p9' => '0', + 'updated' => '0', + 'description' => 'Test menu link 2', + ], + [ + 'menu_name' => 'menu-test-menu', + 'mlid' => 140, + 'plid' => 0, + 'link_path' => 'https://www.drupal.org', + 'router_path' => 'admin/modules', + 'link_title' => 'Test 2', + 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 2";}}', + 'module' => 'menu', + 'hidden' => 0, + 'external' => 0, + 'has_children' => 0, + 'expanded' => 0, + 'weight' => 12, + 'depth' => 2, + 'customized' => 1, + 'p1' => '0', + 'p2' => '0', + 'p3' => '0', + 'p4' => '0', + 'p5' => '0', + 'p6' => '0', + 'p7' => '0', + 'p8' => '0', + 'p9' => '0', + 'updated' => '0', + 'description' => 'Test menu link 2', + ], + [ + 'menu_name' => 'menu-test-menu', + 'mlid' => 141, + 'plid' => 0, + 'link_path' => 'https://api.drupal.org/api/drupal/8.3.x', + 'router_path' => 'admin/modules', + 'link_title' => 'Test 3', + 'options' => 'a:1:{s:10:"attributes";a:1:{s:5:"title";s:16:"Test menu link 3";}}', + 'module' => 'menu', + 'hidden' => 0, + 'external' => 0, + 'has_children' => 0, + 'expanded' => 0, + 'weight' => 12, + 'depth' => 2, + 'customized' => 1, + 'p1' => '0', + 'p2' => '0', + 'p3' => '0', + 'p4' => '0', + 'p5' => '0', + 'p6' => '0', + 'p7' => '0', + 'p8' => '0', + 'p9' => '0', + 'updated' => '0', + 'description' => 'Test menu link 3', + ], + ]; + $test[0]['source_data']['i18n_strings'] = [ + [ + 'lid' => 1, + 'objectid' => 139, + 'type' => 'item', + 'property' => 'title', + 'objectindex' => 0, + 'format' => 0, + ], + [ + 'lid' => 2, + 'objectid' => 139, + 'type' => 'item', + 'property' => 'description', + 'objectindex' => 0, + 'format' => 0, + ], + [ + 'lid' => 3, + 'objectid' => 140, + 'type' => 'item', + 'property' => 'description', + 'objectindex' => 0, + 'format' => 0, + ], + [ + 'lid' => 4, + 'objectid' => 141, + 'type' => 'item', + 'property' => 'title', + 'objectindex' => 0, + 'format' => 0, + ], + ]; + $test[0]['source_data']['locales_target'] = [ + [ + 'lid' => 1, + 'language' => 'fr', + 'translation' => 'fr - title translation', + 'plid' => 0, + 'plural' => 0, + 'u18n_status' => 0, + ], + [ + 'lid' => 2, + 'language' => 'fr', + 'translation' => 'fr - description translation', + 'plid' => 0, + 'plural' => 0, + 'u18n_status' => 0, + ], + [ + 'lid' => 3, + 'language' => 'zu', + 'translation' => 'zu - description translation', + 'plid' => 0, + 'plural' => 0, + 'u18n_status' => 0, + ], + [ + 'lid' => 4, + 'language' => 'zu', + 'translation' => 'zu - title translation', + 'plid' => 0, + 'plural' => 0, + 'u18n_status' => 0, + ], + ]; + + $test[0]['expected_results'] = [ + [ + 'menu_name' => 'menu-test-menu', + 'mlid' => 139, + 'property' => 'title', + 'language' => 'fr', + 'title_untranslated' => 'Test 2', + 'description_untranslated' => 'Test menu link 2', + 'title_translated' => 'fr - title translation', + 'description_translated' => 'fr - description translation', + + ], + [ + 'menu_name' => 'menu-test-menu', + 'mlid' => 139, + 'property' => 'description', + 'language' => 'fr', + 'title_untranslated' => 'Test 2', + 'description_untranslated' => 'Test menu link 2', + 'title_translated' => 'fr - title translation', + 'description_translated' => 'fr - description translation', + ], + [ + 'menu_name' => 'menu-test-menu', + 'mlid' => 140, + 'description' => 'Test menu link 2', + 'property' => 'description', + 'language' => 'zu', + 'title_untranslated' => 'Test 2', + 'description_untranslated' => 'Test menu link 2', + 'title_translated' => NULL, + 'description_translated' => 'zu - description translation', + ], + [ + 'menu_name' => 'menu-test-menu', + 'mlid' => 141, + 'property' => 'title', + 'language' => 'zu', + 'title_untranslated' => 'Test 3', + 'description_untranslated' => 'Test menu link 3', + 'title_translated' => 'zu - title translation', + 'description_translated' => NULL, + ], + ]; + + return $test; + } + +}