reverted: --- b/core/modules/content_translation/migration_templates/d6_block_translation.yml +++ /dev/null @@ -1,64 +0,0 @@ -id: d6_block_translation -label: Blocks translation -migration_tags: - - Drupal 6 -source: - plugin: d6_block_translation - constants: - dest_label: 'settings/label' -process: - langcode: language - property: constants/dest_label - translation: title - id: - plugin: migration - migration: d6_block - source: - - module - - delta - plugin: - - - plugin: static_map - bypass: true - source: - - module - - delta - map: - book: - 0: book_navigation - comment: - 0: views_block:comments_recent-block_1 - forum: - 0: forum_active_block - 1: forum_new_block - locale: - 0: language_block - node: - 0: node_syndicate_block - search: - 0: search_form_block - statistics: - 0: statistics_popular_block - system: - 0: system_powered_by_block - user: - 0: user_login_block - 1: system_menu_block:tools - 2: views_block:who_s_new-block_1 - 3: views_block:who_s_online-who_s_online_block - - - plugin: block_plugin_id - - - plugin: skip_on_empty - method: row - theme: - plugin: block_theme - source: - - theme - - default_theme - - admin_theme -destination: - plugin: entity:block -migration_dependencies: - required: - - d6_block reverted: --- b/core/modules/content_translation/src/Plugin/migrate/source/d6/BlockTranslation.php +++ /dev/null @@ -1,104 +0,0 @@ -getModuleSchemaVersion('system') >= 7000) { - $this->blockTable = 'block'; - } - else { - $this->blockTable = 'blocks'; - } - - $query = $this->select('i18n_blocks', 'i18n') - ->fields('i18n', ['ibid', 'module', 'delta', 'type', 'language']) - ->fields('b', ['bid', 'module', 'delta', 'theme', 'title']); - $query->addField('b', 'module', 'block_module'); - $query->addField('b', 'delta', 'block_delta'); - $query->leftJoin($this->blockTable, 'b', ('b.module = i18n.module AND b.delta = i18n.delta')); - return $query; - } - - /** - * {@inheritdoc} - */ - protected function initializeIterator() { - $this->defaultTheme = $this->variableGet('theme_default', 'Garland'); - $this->adminTheme = $this->variableGet('admin_theme', NULL); - return parent::initializeIterator(); - } - - /** - * {@inheritdoc} - */ - public function fields() { - return [ - 'bid' => $this->t('The block numeric identifier.'), - 'module' => $this->t('The module providing the block.'), - 'delta' => $this->t("The block's delta."), - 'title' => $this->t("Title translation for this language.."), - 'theme' => $this->t('Which theme the block is placed in.'), - 'language' => $this->t('Language for this field.'), - ]; - } - - /** - * {@inheritdoc} - */ - public function getIds() { - $ids['module']['type'] = 'string'; - $ids['module']['alias'] = 'b'; - $ids['delta']['type'] = 'string'; - $ids['delta']['alias'] = 'b'; - $ids['theme']['type'] = 'string'; - $ids['language']['type'] = 'string'; - return $ids; - } - - /** - * {@inheritdoc} - */ - public function prepareRow(Row $row) { - $row->setSourceProperty('default_theme', $this->defaultTheme); - $row->setSourceProperty('admin_theme', $this->adminTheme); - return parent::prepareRow($row); - } - -} reverted: --- b/core/modules/content_translation/tests/src/Kernel/Migrate/d6/MigrateBlockContentTranslationTest.php +++ /dev/null @@ -1,60 +0,0 @@ -installConfig(['block']); - $this->installConfig(['block_content']); - $this->installEntitySchema('block_content'); - - $this->executeMigrations([ - 'd6_filter_format', - 'block_content_type', - 'block_content_body_field', - 'd6_custom_block', - 'd6_user_role', - 'd6_block', - 'd6_block_translation', - ]); - block_rebuild(); - } - - /** - * Tests the migration of block title translation. - */ - public function testBlockContentTranslation() { - $config = \Drupal::service('language_manager')->getLanguageConfigOverride('zu', 'block.block.user_1'); - $this->assertSame('zu - Test Title 02', $config->get('settings.label')); - } - -} reverted: --- b/core/modules/content_translation/tests/src/Kernel/Plugin/migrate/source/d6/BlockTranslationTest.php +++ /dev/null @@ -1,100 +0,0 @@ - 1, - 'module' => 'user', - 'delta' => '1', - 'theme' => 'garland', - 'status' => 1, - 'weight' => 0, - 'region' => 'left', - 'visibility' => 0, - 'pages' => '', - 'title' => 'fr - Test Title 01', - 'cache' => -1, - ], - [ - 'bid' => 2, - 'module' => 'user', - 'delta' => '2', - 'theme' => 'garland', - 'status' => 1, - 'weight' => 5, - 'region' => 'right', - 'visibility' => 0, - 'pages' => '', - 'title' => 'zu - Test Title 02', - 'cache' => -1, - ], - ]; - - $tests[0]['source_data']['i18n_blocks'] = [ - [ - 'ibid' => 1, - 'module' => 'user', - 'delta' => '1', - 'type' => 0, - 'language' => 'fr', - ], - [ - 'ibid' => 2, - 'module' => 'user', - 'delta' => '2', - 'type' => 0, - 'language' => 'zu', - ], - ]; - - // The expected results. - $tests[0]['expected_results'] = [ - [ - 'bid' => 1, - 'module' => 'user', - 'delta' => '1', - 'title' => 'fr - Test Title 01', - 'ibid' => 1, - 'type' => '0', - 'language' => 'fr', - ], - [ - 'bid' => 2, - 'module' => 'user', - 'delta' => '2', - 'theme' => 'garland', - 'title' => 'zu - Test Title 02', - 'ibid' => 2, - 'type' => '0', - 'language' => 'zu', - ], - ]; - - return $tests; - } - -} only in patch2: unchanged: --- /dev/null +++ b/core/modules/block_content/migration_templates/d6_block_translation.yml @@ -0,0 +1,64 @@ +id: d6_block_translation +label: Block translations +migration_tags: + - Drupal 6 +source: + plugin: d6_block_translation + constants: + dest_label: 'settings/label' +process: + langcode: language + property: constants/dest_label + translation: title + id: + plugin: migration + migration: d6_block + source: + - module + - delta + plugin: + - + plugin: static_map + bypass: true + source: + - module + - delta + map: + book: + 0: book_navigation + comment: + 0: views_block:comments_recent-block_1 + forum: + 0: forum_active_block + 1: forum_new_block + locale: + 0: language_block + node: + 0: node_syndicate_block + search: + 0: search_form_block + statistics: + 0: statistics_popular_block + system: + 0: system_powered_by_block + user: + 0: user_login_block + 1: system_menu_block:tools + 2: views_block:who_s_new-block_1 + 3: views_block:who_s_online-who_s_online_block + - + plugin: block_plugin_id + - + plugin: skip_on_empty + method: row + theme: + plugin: block_theme + source: + - theme + - default_theme + - admin_theme +destination: + plugin: entity:block +migration_dependencies: + required: + - d6_block only in patch2: unchanged: --- /dev/null +++ b/core/modules/block_content/src/Plugin/migrate/source/d6/BlockTranslation.php @@ -0,0 +1,104 @@ +getModuleSchemaVersion('system') >= 7000) { + $this->blockTable = 'block'; + } + else { + $this->blockTable = 'blocks'; + } + + $query = $this->select('i18n_blocks', 'i18n') + ->fields('i18n', ['ibid', 'module', 'delta', 'type', 'language']) + ->fields('b', ['bid', 'module', 'delta', 'theme', 'title']); + $query->addField('b', 'module', 'block_module'); + $query->addField('b', 'delta', 'block_delta'); + $query->leftJoin($this->blockTable, 'b', ('b.module = i18n.module AND b.delta = i18n.delta')); + return $query; + } + + /** + * {@inheritdoc} + */ + protected function initializeIterator() { + $this->defaultTheme = $this->variableGet('theme_default', 'Garland'); + $this->adminTheme = $this->variableGet('admin_theme', NULL); + return parent::initializeIterator(); + } + + /** + * {@inheritdoc} + */ + public function fields() { + return [ + 'bid' => $this->t('The block numeric identifier.'), + 'module' => $this->t('The module providing the block.'), + 'delta' => $this->t("The block's delta."), + 'title' => $this->t("Title translation for this language.."), + 'theme' => $this->t('Which theme the block is placed in.'), + 'language' => $this->t('Language for this field.'), + ]; + } + + /** + * {@inheritdoc} + */ + public function getIds() { + $ids['module']['type'] = 'string'; + $ids['module']['alias'] = 'b'; + $ids['delta']['type'] = 'string'; + $ids['delta']['alias'] = 'b'; + $ids['theme']['type'] = 'string'; + $ids['language']['type'] = 'string'; + return $ids; + } + + /** + * {@inheritdoc} + */ + public function prepareRow(Row $row) { + $row->setSourceProperty('default_theme', $this->defaultTheme); + $row->setSourceProperty('admin_theme', $this->adminTheme); + return parent::prepareRow($row); + } + +} only in patch2: unchanged: --- /dev/null +++ b/core/modules/block_content/tests/src/Kernel/Migrate/d6/MigrateBlockContentTranslationTest.php @@ -0,0 +1,60 @@ +installConfig(['block']); + $this->installConfig(['block_content']); + $this->installEntitySchema('block_content'); + + $this->executeMigrations([ + 'd6_filter_format', + 'block_content_type', + 'block_content_body_field', + 'd6_custom_block', + 'd6_user_role', + 'd6_block', + 'd6_block_translation', + ]); + block_rebuild(); + } + + /** + * Tests the migration of block title translation. + */ + public function testBlockContentTranslation() { + $config = \Drupal::service('language_manager')->getLanguageConfigOverride('zu', 'block.block.user_1'); + $this->assertSame('zu - Test Title 02', $config->get('settings.label')); + } + +} only in patch2: unchanged: --- /dev/null +++ b/core/modules/block_content/tests/src/Kernel/Plugin/migrate/source/d6/BlockTranslationTest.php @@ -0,0 +1,100 @@ + 1, + 'module' => 'user', + 'delta' => '1', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 0, + 'region' => 'left', + 'visibility' => 0, + 'pages' => '', + 'title' => 'fr - Test Title 01', + 'cache' => -1, + ], + [ + 'bid' => 2, + 'module' => 'user', + 'delta' => '2', + 'theme' => 'garland', + 'status' => 1, + 'weight' => 5, + 'region' => 'right', + 'visibility' => 0, + 'pages' => '', + 'title' => 'zu - Test Title 02', + 'cache' => -1, + ], + ]; + + $tests[0]['source_data']['i18n_blocks'] = [ + [ + 'ibid' => 1, + 'module' => 'user', + 'delta' => '1', + 'type' => 0, + 'language' => 'fr', + ], + [ + 'ibid' => 2, + 'module' => 'user', + 'delta' => '2', + 'type' => 0, + 'language' => 'zu', + ], + ]; + + // The expected results. + $tests[0]['expected_results'] = [ + [ + 'bid' => 1, + 'module' => 'user', + 'delta' => '1', + 'title' => 'fr - Test Title 01', + 'ibid' => 1, + 'type' => '0', + 'language' => 'fr', + ], + [ + 'bid' => 2, + 'module' => 'user', + 'delta' => '2', + 'theme' => 'garland', + 'title' => 'zu - Test Title 02', + 'ibid' => 2, + 'type' => '0', + 'language' => 'zu', + ], + ]; + + return $tests; + } + +}