Commit 33511d35 authored by Gábor Hojtsy's avatar Gábor Hojtsy

Issue #2953360 by quietone, heddn, yogeshmpawar, phenaproxima, Gábor Hojtsy,...

Issue #2953360 by quietone, heddn, yogeshmpawar, phenaproxima, Gábor Hojtsy, maxocub, catch, alexpott, masipila: Experimental migrate_drupal_multilingual module

(cherry picked from commit 20f44c05)
parent 4f79e034
...@@ -138,6 +138,7 @@ ...@@ -138,6 +138,7 @@
"drupal/menu_ui": "self.version", "drupal/menu_ui": "self.version",
"drupal/migrate": "self.version", "drupal/migrate": "self.version",
"drupal/migrate_drupal": "self.version", "drupal/migrate_drupal": "self.version",
"drupal/migrate_drupal_multilingual": "self.version",
"drupal/migrate_drupal_ui": "self.version", "drupal/migrate_drupal_ui": "self.version",
"drupal/node": "self.version", "drupal/node": "self.version",
"drupal/options": "self.version", "drupal/options": "self.version",
......
...@@ -26,6 +26,8 @@ class MigrateBlockContentTranslationTest extends MigrateDrupal6TestBase { ...@@ -26,6 +26,8 @@ class MigrateBlockContentTranslationTest extends MigrateDrupal6TestBase {
'language', 'language',
'statistics', 'statistics',
'taxonomy', 'taxonomy',
// Required for translation migrations.
'migrate_drupal_multilingual',
]; ];
/** /**
......
...@@ -19,6 +19,8 @@ class MigrateCustomBlockContentTranslationTest extends MigrateDrupal6TestBase { ...@@ -19,6 +19,8 @@ class MigrateCustomBlockContentTranslationTest extends MigrateDrupal6TestBase {
'block_content', 'block_content',
'content_translation', 'content_translation',
'language', 'language',
// Required for translation migrations.
'migrate_drupal_multilingual',
]; ];
/** /**
......
...@@ -3,6 +3,7 @@ label: Maintenance page configuration ...@@ -3,6 +3,7 @@ label: Maintenance page configuration
migration_tags: migration_tags:
- Drupal 6 - Drupal 6
- Configuration - Configuration
- Multilingual
source: source:
plugin: variable_translation plugin: variable_translation
variables: variables:
......
...@@ -3,6 +3,7 @@ label: Site configuration ...@@ -3,6 +3,7 @@ label: Site configuration
migration_tags: migration_tags:
- Drupal 6 - Drupal 6
- Configuration - Configuration
- Multilingual
source: source:
plugin: variable_translation plugin: variable_translation
constants: constants:
......
...@@ -3,6 +3,7 @@ label: Taxonomy vocabularies ...@@ -3,6 +3,7 @@ label: Taxonomy vocabularies
migration_tags: migration_tags:
- Drupal 6 - Drupal 6
- Configuration - Configuration
- Multilingual
source: source:
plugin: d6_taxonomy_vocabulary_translation plugin: d6_taxonomy_vocabulary_translation
process: process:
...@@ -23,6 +24,7 @@ process: ...@@ -23,6 +24,7 @@ process:
translation: translation translation: translation
destination: destination:
plugin: entity:taxonomy_vocabulary plugin: entity:taxonomy_vocabulary
destination_module: config_translation
migration_dependencies: migration_dependencies:
required: required:
- d6_taxonomy_vocabulary - d6_taxonomy_vocabulary
...@@ -3,6 +3,7 @@ label: User mail configuration ...@@ -3,6 +3,7 @@ label: User mail configuration
migration_tags: migration_tags:
- Drupal 6 - Drupal 6
- Configuration - Configuration
- Multilingual
source: source:
plugin: variable_translation plugin: variable_translation
variables: variables:
......
...@@ -3,6 +3,7 @@ label: User profile field instance configuration ...@@ -3,6 +3,7 @@ label: User profile field instance configuration
migration_tags: migration_tags:
- Drupal 6 - Drupal 6
- Configuration - Configuration
- Multilingual
source: source:
plugin: d6_profile_field_translation plugin: d6_profile_field_translation
constants: constants:
......
...@@ -3,6 +3,7 @@ label: User configuration ...@@ -3,6 +3,7 @@ label: User configuration
migration_tags: migration_tags:
- Drupal 6 - Drupal 6
- Configuration - Configuration
- Multilingual
source: source:
plugin: variable_translation plugin: variable_translation
variables: variables:
......
...@@ -12,7 +12,12 @@ ...@@ -12,7 +12,12 @@
*/ */
class MigrateSystemMaintenanceTranslationTest extends MigrateDrupal6TestBase { class MigrateSystemMaintenanceTranslationTest extends MigrateDrupal6TestBase {
public static $modules = ['language', 'config_translation']; public static $modules = [
'language',
'config_translation',
// Required for translation migrations.
'migrate_drupal_multilingual',
];
/** /**
* {@inheritdoc} * {@inheritdoc}
......
...@@ -12,7 +12,12 @@ ...@@ -12,7 +12,12 @@
*/ */
class MigrateSystemSiteTranslationTest extends MigrateDrupal6TestBase { class MigrateSystemSiteTranslationTest extends MigrateDrupal6TestBase {
public static $modules = ['language', 'config_translation']; public static $modules = [
'language',
'config_translation',
// Required for translation migrations.
'migrate_drupal_multilingual',
];
/** /**
* {@inheritdoc} * {@inheritdoc}
......
...@@ -15,7 +15,13 @@ class MigrateUserConfigsTranslationTest extends MigrateDrupal6TestBase { ...@@ -15,7 +15,13 @@ class MigrateUserConfigsTranslationTest extends MigrateDrupal6TestBase {
use SchemaCheckTestTrait; use SchemaCheckTestTrait;
public static $modules = ['language', 'locale', 'config_translation']; public static $modules = [
'language',
'locale',
'config_translation',
// Required for translation migrations.
'migrate_drupal_multilingual',
];
/** /**
* {@inheritdoc} * {@inheritdoc}
......
...@@ -15,7 +15,14 @@ class MigrateUserProfileFieldInstanceTranslationTest extends MigrateDrupal6TestB ...@@ -15,7 +15,14 @@ class MigrateUserProfileFieldInstanceTranslationTest extends MigrateDrupal6TestB
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public static $modules = ['config_translation', 'locale', 'language', 'field']; public static $modules = [
'config_translation',
'locale',
'language',
'field',
// Required for translation migrations.
'migrate_drupal_multilingual',
];
/** /**
* Tests migration of translated user profile fields. * Tests migration of translated user profile fields.
......
...@@ -3,6 +3,7 @@ label: Block translations ...@@ -3,6 +3,7 @@ label: Block translations
migration_tags: migration_tags:
- Drupal 6 - Drupal 6
- Configuration - Configuration
- Multilingual
source: source:
plugin: d6_block_translation plugin: d6_block_translation
constants: constants:
......
...@@ -3,6 +3,7 @@ label: Custom block translations ...@@ -3,6 +3,7 @@ label: Custom block translations
migration_tags: migration_tags:
- Drupal 6 - Drupal 6
- Content - Content
- Multilingual
source: source:
plugin: d6_box_translation plugin: d6_box_translation
process: process:
......
...@@ -2,6 +2,7 @@ id: d6_entity_reference_translation ...@@ -2,6 +2,7 @@ id: d6_entity_reference_translation
label: Entity reference translations label: Entity reference translations
migration_tags: migration_tags:
- Drupal 6 - Drupal 6
- Multilingual
- Follow-up migration - Follow-up migration
deriver: Drupal\migrate_drupal\Plugin\migrate\EntityReferenceTranslationDeriver deriver: Drupal\migrate_drupal\Plugin\migrate\EntityReferenceTranslationDeriver
# Supported target types for entity reference translation migrations. The array # Supported target types for entity reference translation migrations. The array
......
...@@ -3,6 +3,7 @@ label: Menu links ...@@ -3,6 +3,7 @@ label: Menu links
migration_tags: migration_tags:
- Drupal 6 - Drupal 6
- Content - Content
- Multilingual
source: source:
plugin: d6_menu_link_translation plugin: d6_menu_link_translation
process: process:
......
...@@ -4,6 +4,7 @@ migration_tags: ...@@ -4,6 +4,7 @@ migration_tags:
- Drupal 6 - Drupal 6
- translation - translation
- Content - Content
- Multilingual
class: Drupal\node\Plugin\migrate\D6NodeTranslation class: Drupal\node\Plugin\migrate\D6NodeTranslation
deriver: Drupal\node\Plugin\migrate\D6NodeDeriver deriver: Drupal\node\Plugin\migrate\D6NodeDeriver
source: source:
......
...@@ -3,6 +3,7 @@ label: Taxonomy terms ...@@ -3,6 +3,7 @@ label: Taxonomy terms
migration_tags: migration_tags:
- Drupal 6 - Drupal 6
- Content - Content
- Multilingual
source: source:
plugin: d6_taxonomy_term plugin: d6_taxonomy_term
translations: true translations: true
...@@ -34,6 +35,7 @@ process: ...@@ -34,6 +35,7 @@ process:
changed: timestamp changed: timestamp
destination: destination:
plugin: entity:taxonomy_term plugin: entity:taxonomy_term
destination_module: content_translation
migration_dependencies: migration_dependencies:
required: required:
- d6_taxonomy_vocabulary - d6_taxonomy_vocabulary
......
...@@ -2,6 +2,7 @@ id: d7_entity_reference_translation ...@@ -2,6 +2,7 @@ id: d7_entity_reference_translation
label: Entity reference translations label: Entity reference translations
migration_tags: migration_tags:
- Drupal 7 - Drupal 7
- Multilingual
- Follow-up migration - Follow-up migration
deriver: Drupal\migrate_drupal\Plugin\migrate\EntityReferenceTranslationDeriver deriver: Drupal\migrate_drupal\Plugin\migrate\EntityReferenceTranslationDeriver
# Supported target types for entity reference translation migrations. The array # Supported target types for entity reference translation migrations. The array
......
...@@ -3,6 +3,7 @@ label: Drupal 7 Entity Translation settings ...@@ -3,6 +3,7 @@ label: Drupal 7 Entity Translation settings
migration_tags: migration_tags:
- Drupal 7 - Drupal 7
- Configuration - Configuration
- Multilingual
source: source:
plugin: d7_entity_translation_settings plugin: d7_entity_translation_settings
process: process:
......
...@@ -4,6 +4,7 @@ migration_tags: ...@@ -4,6 +4,7 @@ migration_tags:
- Drupal 7 - Drupal 7
- translation - translation
- Content - Content
- Multilingual
class: Drupal\node\Plugin\migrate\D7NodeTranslation class: Drupal\node\Plugin\migrate\D7NodeTranslation
deriver: Drupal\node\Plugin\migrate\D7NodeDeriver deriver: Drupal\node\Plugin\migrate\D7NodeDeriver
source: source:
......
...@@ -5,6 +5,7 @@ migration_tags: ...@@ -5,6 +5,7 @@ migration_tags:
- Drupal 6 - Drupal 6
- Drupal 7 - Drupal 7
- Content - Content
- Multilingual
source: source:
plugin: menu_link plugin: menu_link
constants: constants:
......
...@@ -4,6 +4,7 @@ migration_tags: ...@@ -4,6 +4,7 @@ migration_tags:
- Drupal 6 - Drupal 6
- Drupal 7 - Drupal 7
- Content - Content
- Multilingual
source: source:
plugin: node_counter plugin: node_counter
process: process:
......
...@@ -20,6 +20,8 @@ class MigrateTaxonomyTermTranslationTest extends MigrateDrupal6TestBase { ...@@ -20,6 +20,8 @@ class MigrateTaxonomyTermTranslationTest extends MigrateDrupal6TestBase {
'content_translation', 'content_translation',
'language', 'language',
'menu_ui', 'menu_ui',
// Required for translation migrations.
'migrate_drupal_multilingual',
'node', 'node',
'taxonomy', 'taxonomy',
]; ];
......
...@@ -20,6 +20,8 @@ class MigrateEntityTranslationSettingsTest extends MigrateDrupal7TestBase { ...@@ -20,6 +20,8 @@ class MigrateEntityTranslationSettingsTest extends MigrateDrupal7TestBase {
'content_translation', 'content_translation',
'language', 'language',
'menu_ui', 'menu_ui',
// Required for translation migrations.
'migrate_drupal_multilingual',
'node', 'node',
'taxonomy', 'taxonomy',
'text', 'text',
......
...@@ -20,6 +20,8 @@ class MigrateMenuLinkTest extends MigrateNodeTestBase { ...@@ -20,6 +20,8 @@ class MigrateMenuLinkTest extends MigrateNodeTestBase {
'content_translation', 'content_translation',
'language', 'language',
'menu_link_content', 'menu_link_content',
// Required for translation migrations.
'migrate_drupal_multilingual',
'menu_ui', 'menu_ui',
]; ];
......
...@@ -20,6 +20,8 @@ class MigrateMenuLinkTranslationTest extends MigrateDrupal6TestBase { ...@@ -20,6 +20,8 @@ class MigrateMenuLinkTranslationTest extends MigrateDrupal6TestBase {
'menu_link_content', 'menu_link_content',
'language', 'language',
'content_translation', 'content_translation',
// Required for translation migrations.
'migrate_drupal_multilingual',
]; ];
/** /**
......
...@@ -24,6 +24,8 @@ class MigrateMenuLinkTest extends MigrateDrupal7TestBase { ...@@ -24,6 +24,8 @@ class MigrateMenuLinkTest extends MigrateDrupal7TestBase {
'link', 'link',
'menu_ui', 'menu_ui',
'menu_link_content', 'menu_link_content',
// Required for translation migrations.
'migrate_drupal_multilingual',
'node', 'node',
'text', 'text',
]; ];
......
...@@ -24,3 +24,10 @@ function migrate_drupal_update_8502() { ...@@ -24,3 +24,10 @@ function migrate_drupal_update_8502() {
->set('follow_up_migration_tags', ['Follow-up migration']) ->set('follow_up_migration_tags', ['Follow-up migration'])
->save(); ->save();
} }
/**
* Install migrate_drupal_multilingual since migrate_drupal is installed.
*/
function migrate_drupal_update_8601() {
\Drupal::service('module_installer')->install(['migrate_drupal_multilingual']);
}
...@@ -110,6 +110,12 @@ protected function getMigrations($database_state_key, $drupal_version) { ...@@ -110,6 +110,12 @@ protected function getMigrations($database_state_key, $drupal_version) {
if (!empty(array_intersect($migration->getMigrationTags(), $this->getFollowUpMigrationTags()))) { if (!empty(array_intersect($migration->getMigrationTags(), $this->getFollowUpMigrationTags()))) {
continue; continue;
} }
// Multilingual migrations require migrate_drupal_multilingual.
$tags = $migration->getMigrationTags() ?: [];
if (in_array('Multilingual', $tags, TRUE) && (!\Drupal::service('module_handler')->moduleExists('migrate_drupal_multilingual'))) {
throw new RequirementsException(sprintf("Install migrate_drupal_multilingual to run migration '%s'.", $migration->getPluginId()));
}
try { try {
// @todo https://drupal.org/node/2681867 We should be able to validate // @todo https://drupal.org/node/2681867 We should be able to validate
// the entire migration at this point. // the entire migration at this point.
......
...@@ -19,6 +19,8 @@ class FollowUpMigrationsTest extends MigrateNodeTestBase { ...@@ -19,6 +19,8 @@ class FollowUpMigrationsTest extends MigrateNodeTestBase {
'content_translation', 'content_translation',
'language', 'language',
'menu_ui', 'menu_ui',
// A requirement for d6_node_translation.
'migrate_drupal_multilingual',
]; ];
/** /**
......
...@@ -26,6 +26,8 @@ class FollowUpMigrationsTest extends MigrateDrupal7TestBase { ...@@ -26,6 +26,8 @@ class FollowUpMigrationsTest extends MigrateDrupal7TestBase {
'language', 'language',
'link', 'link',
'menu_ui', 'menu_ui',
// A requirement for translation migrations.
'migrate_drupal_multilingual',
'node', 'node',
'taxonomy', 'taxonomy',
'telephone', 'telephone',
......
name: 'Migrate Drupal Multilingual'
type: module
description: 'Provides a requirement for multilingual migrations.'
package: 'Core (Experimental)'
core: 8.x
dependencies:
- migrate_drupal
<?php
/**
* @file
* Provides a requirement for multilingual content and configuration migrations.
*/
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Implements hook_help().
*/
function migrate_drupal_multilingual_help($route_name, RouteMatchInterface $route_match) {
switch ($route_name) {
case 'help.page.migrate_drupal_multilingual':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The Migrate Drupal Multilingual module is a requirement for migrating translations. It does not provide a user interface. For more information, see the <a href=":migrate_drupal_multilingual">online documentation for the Migrate Drupal Multilingual module</a>.', [':migrate_drupal_multilingual' => 'https://www.drupal.org/node/2959712']) . '</p>';
return $output;
}
}
...@@ -59,7 +59,6 @@ protected function getAvailablePaths() { ...@@ -59,7 +59,6 @@ protected function getAvailablePaths() {
'filefield', 'filefield',
'filter', 'filter',
'forum', 'forum',
'i18ntaxonomy',
'imagecache', 'imagecache',
'imagefield', 'imagefield',
'language', 'language',
...@@ -142,6 +141,7 @@ protected function getMissingPaths() { ...@@ -142,6 +141,7 @@ protected function getMissingPaths() {
'i18npoll', 'i18npoll',