diff -u b/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php b/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php --- b/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php +++ b/core/modules/comment/src/Plugin/migrate/destination/EntityComment.php @@ -42,9 +42,11 @@ protected $stubCommentedEntityIds; /** + * The language mangager. + * * @var \Drupal\Core\Language\LanguageManagerInterface */ - protected $language_manager; + protected $languageManager; /** * Builds an comment entity destination. @@ -76,7 +78,7 @@ parent::__construct($configuration, $plugin_id, $plugin_definition, $migration, $storage, $bundles, $language_manager, $entity_manager, $field_type_manager); $this->state = $state; $this->entityQuery = $entity_query; - $this->language_manager = $language_manager; + $this->languageManager = $language_manager; } /** @@ -90,8 +92,7 @@ $plugin_definition, $migration, $container->get('entity.manager')->getStorage($entity_type), - array_keys($container->get('entity.manager') - ->getBundleInfo($entity_type)), + array_keys($container->get('entity.manager')->getBundleInfo($entity_type)), $container->get('language_manager'), $container->get('entity.manager'), $container->get('plugin.manager.field.field_type'), diff -u b/core/modules/config_translation/src/Plugin/migrate/source/d6/I18nBlock.php b/core/modules/config_translation/src/Plugin/migrate/source/d6/I18nBlock.php --- b/core/modules/config_translation/src/Plugin/migrate/source/d6/I18nBlock.php +++ b/core/modules/config_translation/src/Plugin/migrate/source/d6/I18nBlock.php @@ -61,7 +61,7 @@ */ protected function initializeIterator() { $this->defaultTheme = $this->variableGet('theme_default', 'Garland'); - $this->adminTheme = $this->variableGet('admin_theme', null); + $this->adminTheme = $this->variableGet('admin_theme', NULL); return parent::initializeIterator(); } @@ -72,12 +72,12 @@ return [ 'bid' => $this->t('The block numeric identifier.'), 'module' => $this->t('The module providing the block.'), - 'delta' => $this->t('The block\'s delta.'), + 'delta' => $this->t("The block's delta."), 'theme' => $this->t('Which theme the block is placed in.'), 'language' => $this->t('Language for this field.'), 'property' => $this->t('Name of property being translated.'), - 'translation' => $this->t('Translation of either the title or explanation.' - )]; + 'translation' => $this->t('Translation of either the title or explanation.'), + ]; } /** @@ -101,2 +101,3 @@ } + } reverted: --- b/core/modules/config_translation/tests/src/Unit/Plugin/migrate/source/d6/I18nBlockSourceTest.php +++ /dev/null @@ -1,161 +0,0 @@ - 'id', - 'source' => [ - 'plugin' => 'test', - ], - ]; - - protected $blocks = [ - [ - 'bid' => 1, - 'module' => 'block', - 'delta' => '1', - 'theme' => 'garland', - 'status' => 1, - 'weight' => 0, - 'region' => 'left', - 'custom' => 0, - 'throttle' => 0, - 'visibility' => 1, - 'pages' => '', - 'title' => 'Test Title 01', - 'cache' => -1, - ], - [ - 'bid' => 2, - 'module' => 'block', - 'delta' => '2', - 'theme' => 'garland', - 'status' => 1, - 'weight' => 5, - 'region' => 'right', - 'custom' => 0, - 'throttle' => 0, - 'visibility' => 0, - 'pages' => '', - 'title' => 'Test Title 02', - 'cache' => -1, - ], - ]; - - protected $i18n_strings = [ - [ - 'lid' => 1, - 'objectid' => 1, - 'type' => 'block', - 'property' => 'title', - 'objectindex' => 0, - 'format' => 0, - ], - [ - 'lid' => 2, - 'objectid' => 1, - 'type' => 'block', - 'property' => 'body', - 'objectindex' => 0, - 'format' => 0, - ], - [ - 'lid' => 3, - 'objectid' => 2, - 'type' => 'block', - 'property' => 'body', - 'objectindex' => 0, - 'format' => 2, - ] - ]; - - protected $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, - ], - ]; - - protected $expectedResults = [ - [ - 'lid' => '1', - 'type' => 'block', - 'property' => 'title', - 'objectid' => '1', - 'lt_lid' => '1', - 'language' => 'fr', - 'translation' => 'fr - title translation', - 'bid' => '1', - 'module' => 'block', - 'delta' => '1', - ], - [ - 'lid' => '2', - 'type' => 'block', - 'property' => 'body', - 'objectid' => '1', - 'lt_lid' => '2', - 'language' => 'fr', - 'translation' => 'fr - description translation', - 'bid' => '1', - 'module' => 'block', - 'delta' => '1', - ], - [ - 'lid' => '3', - 'type' => 'block', - 'property' => 'body', - 'objectid' => '2', - 'lt_lid' => '3', - 'language' => 'zu', - 'translation' => 'zu - description translation', - 'bid' => '2', - 'module' => 'block', - 'delta' => '2', - ], - ]; - - /** - * {@inheritdoc} - */ - protected function setUp() { - $this->databaseContents['blocks'] = $this->blocks; - $this->databaseContents['i18n_strings'] = $this->i18n_strings; - $this->databaseContents['locales_target'] = $this->locales_target; - - parent::setUp(); - } - -} - diff -u b/core/modules/content_translation/src/Plugin/migrate/source/d6/I18nBox.php b/core/modules/content_translation/src/Plugin/migrate/source/d6/I18nBox.php --- b/core/modules/content_translation/src/Plugin/migrate/source/d6/I18nBox.php +++ b/core/modules/content_translation/src/Plugin/migrate/source/d6/I18nBox.php @@ -34,6 +34,7 @@ * Merge the block body and info translations into a single row. * * @return array + * An array of ... */ protected function values() { $values = []; @@ -86,7 +87,7 @@ 'language' => $this->t('Language for this field.'), 'body' => $this->t('The block/box content'), 'info' => $this->t('Admin title of the block/box.'), - 'format' => $this->t('Input format of the custom block/box content.') + 'format' => $this->t('Input format of the custom block/box content.'), ]; } reverted: --- b/core/modules/content_translation/tests/src/Unit/Plugin/migrate/source/d6/I18nBoxTest.php +++ /dev/null @@ -1,149 +0,0 @@ - 'id', - 'source' => [ - 'plugin' => 'test', - ], - ]; - /** - * Sample block instance query results from the source. - */ - protected $boxes = [ - [ - 'bid' => 1, - 'body' => 'box 1 body', - 'info' => 'box 1 info', - 'format' => '2', - ], - [ - 'bid' => 2, - 'body' => 'box 2 body', - 'info' => 'box 2 info', - 'format' => '2', - ], - ]; - - protected $i18n_strings = [ - [ - 'lid' => 1, - 'objectid' => 1, - 'type' => 'block', - 'property' => 'title', - 'objectindex' => 0, - 'format' => 0, - ], - [ - 'lid' => 2, - 'objectid' => 1, - 'type' => 'block', - 'property' => 'body', - 'objectindex' => 0, - 'format' => 0, - ], - [ - 'lid' => 3, - 'objectid' => 2, - 'type' => 'block', - 'property' => 'body', - 'objectindex' => 0, - 'format' => 2, - ] - ]; - - protected $locales_target = [ - [ - 'lid' => 1, - 'language' => 'fr', - 'translation' => 'fr - info translation', - 'plid' => 0, - 'plural' => 0, - 'i18n_status' => 0, - ], - [ - 'lid' => 2, - 'language' => 'fr', - 'translation' => 'fr - body translation', - 'plid' => 0, - 'plural' => 0, - 'i18n_status' => 0, - ], - [ - 'lid' => 2, - 'language' => 'zu', - 'translation' => 'zu - body translation', - 'plid' => 0, - 'plural' => 0, - 'i18n_status' => 0, - ], - ]; - - protected $expectedResults = [ - [ - 'lid' => '2', - 'type' => 'block', - 'property' => 'body', - 'objectid' => '1', - 'lt_lid' => '2', - 'language' => 'fr', - 'translation' => 'fr - body translation', - 'bid' => '1', - 'body' => 'fr - body translation', - 'info' => 'fr - info translation', - 'format' => '2', - ], - [ - 'lid' => '2', - 'type' => 'block', - 'property' => 'body', - 'objectid' => '1', - 'lt_lid' => '2', - 'language' => 'zu', - 'translation' => 'zu - body translation', - 'bid' => '1', - 'body' => 'zu - body translation', - 'info' => 'box 1 info', - 'format' => '2', - ], - [ - 'lid' => '3', - 'type' => 'block', - 'property' => 'body', - 'objectid' => '2', - 'lt_lid' => Null, - 'language' => Null, - 'translation' => Null, - 'bid' => '2', - 'body' => Null, - 'info' => 'box 2 info', - 'format' => '2', - ], - ]; - - /** - * {@inheritdoc} - */ - protected function setUp() { - $this->databaseContents['boxes'] = $this->boxes; - $this->databaseContents['i18n_strings'] = $this->i18n_strings; - $this->databaseContents['locales_target'] = $this->locales_target; - - parent::setUp(); - } - -} - 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 @@ -66,6 +66,10 @@ 'source_module' => 'block', 'destination_module' => 'block', ], + 'd6_i18n_block' => [ + 'source_module' => 'translation', + 'destination_module' => 'config_translation', + ], 'd7_block' => [ 'source_module' => 'block', 'destination_module' => 'block', only in patch2: unchanged: --- /dev/null +++ b/core/modules/config_translation/tests/src/Kernel/Plugin/migrate/source/d6/I18nBlockSourceTest.php @@ -0,0 +1,157 @@ + 1, + 'module' => 'block', + 'delta' => '1', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 0, + 'region' => 'left', + 'custom' => 0, + 'throttle' => 0, + 'visibility' => 1, + 'pages' => '', + 'title' => 'Test Title 01', + 'cache' => -1, + ], + [ + 'bid' => 2, + 'module' => 'block', + 'delta' => '2', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 5, + 'region' => 'right', + 'custom' => 0, + 'throttle' => 0, + 'visibility' => 0, + 'pages' => '', + 'title' => 'Test Title 02', + 'cache' => -1, + ], + ]; + + $tests[0]['database']['i18n_strings'] = [ + [ + 'lid' => 1, + 'objectid' => 1, + 'type' => 'block', + 'property' => 'title', + 'objectindex' => 0, + 'format' => 0, + ], + [ + 'lid' => 2, + 'objectid' => 1, + 'type' => 'block', + 'property' => 'body', + 'objectindex' => 0, + 'format' => 0, + ], + [ + 'lid' => 3, + 'objectid' => 2, + 'type' => 'block', + 'property' => 'body', + 'objectindex' => 0, + 'format' => 2, + ], + ]; + + $tests[0]['database']['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, + ], + ]; + + $tests[0]['expectedResults'] = [ + [ + 'lid' => '1', + 'type' => 'block', + 'property' => 'title', + 'objectid' => '1', + 'lt_lid' => '1', + 'language' => 'fr', + 'translation' => 'fr - title translation', + 'bid' => '1', + 'module' => 'block', + 'delta' => '1', + ], + [ + 'lid' => '2', + 'type' => 'block', + 'property' => 'body', + 'objectid' => '1', + 'lt_lid' => '2', + 'language' => 'fr', + 'translation' => 'fr - description translation', + 'bid' => '1', + 'module' => 'block', + 'delta' => '1', + ], + [ + 'lid' => '3', + 'type' => 'block', + 'property' => 'body', + 'objectid' => '2', + 'lt_lid' => '3', + 'language' => 'zu', + 'translation' => 'zu - description translation', + 'bid' => '2', + 'module' => 'block', + 'delta' => '2', + ], + ]; + + return $tests; + } + +} only in patch2: unchanged: --- /dev/null +++ b/core/modules/content_translation/tests/src/Kernel/Plugin/migrate/source/d6/I18nBoxTest.php @@ -0,0 +1,143 @@ + 1, + 'body' => 'box 1 body', + 'info' => 'box 1 info', + 'format' => '2', + ], + [ + 'bid' => 2, + 'body' => 'box 2 body', + 'info' => 'box 2 info', + 'format' => '2', + ], + ]; + + $tests[0]['database']['i18n_strings'] = [ + [ + 'lid' => 1, + 'objectid' => 1, + 'type' => 'block', + 'property' => 'title', + 'objectindex' => 0, + 'format' => 0, + ], + [ + 'lid' => 2, + 'objectid' => 1, + 'type' => 'block', + 'property' => 'body', + 'objectindex' => 0, + 'format' => 0, + ], + [ + 'lid' => 3, + 'objectid' => 2, + 'type' => 'block', + 'property' => 'body', + 'objectindex' => 0, + 'format' => 2, + ], + ]; + + $tests[0]['database']['locales_target'] = [ + [ + 'lid' => 1, + 'language' => 'fr', + 'translation' => 'fr - info translation', + 'plid' => 0, + 'plural' => 0, + 'i18n_status' => 0, + ], + [ + 'lid' => 2, + 'language' => 'fr', + 'translation' => 'fr - body translation', + 'plid' => 0, + 'plural' => 0, + 'i18n_status' => 0, + ], + [ + 'lid' => 2, + 'language' => 'zu', + 'translation' => 'zu - body translation', + 'plid' => 0, + 'plural' => 0, + 'i18n_status' => 0, + ], + ]; + + // The expected results. + $tests[0]['expected_results'] = [ + [ + 'lid' => '2', + 'type' => 'block', + 'property' => 'body', + 'objectid' => '1', + 'lt_lid' => '2', + 'language' => 'fr', + 'translation' => 'fr - body translation', + 'bid' => '1', + 'body' => 'fr - body translation', + 'info' => 'fr - info translation', + 'format' => '2', + ], + [ + 'lid' => '2', + 'type' => 'block', + 'property' => 'body', + 'objectid' => '1', + 'lt_lid' => '2', + 'language' => 'zu', + 'translation' => 'zu - body translation', + 'bid' => '1', + 'body' => 'zu - body translation', + 'info' => 'box 1 info', + 'format' => '2', + ], + [ + 'lid' => '3', + 'type' => 'block', + 'property' => 'body', + 'objectid' => '2', + 'lt_lid' => NULL, + 'language' => NULL, + 'translation' => NULL, + 'bid' => '2', + 'body' => NULL, + 'info' => 'box 2 info', + 'format' => '2', + ], + ]; + + return $tests; + } + +}