summaryrefslogtreecommitdiffstats
path: root/core/modules/migrate_drupal
diff options
context:
space:
mode:
authorGábor Hojtsy2018-07-26 16:49:16 (GMT)
committerGábor Hojtsy2018-07-26 16:58:22 (GMT)
commit33511d354c7d6c10e2660898af769ec372efc7f0 (patch)
tree4d6c5e06479f119b3b96824ba0b4c49c97035c28 /core/modules/migrate_drupal
parent4f79e034414a3edae41dd20ba05429adce9f3997 (diff)
Issue #2953360 by quietone, heddn, yogeshmpawar, phenaproxima, Gábor Hojtsy, maxocub, catch, alexpott, masipila: Experimental migrate_drupal_multilingual module
(cherry picked from commit 20f44c056c72664ff157ecda138f03e8cc8cadec)
Diffstat (limited to 'core/modules/migrate_drupal')
-rw-r--r--core/modules/migrate_drupal/migrate_drupal.install7
-rw-r--r--core/modules/migrate_drupal/migrations/d6_entity_reference_translation.yml22
-rw-r--r--core/modules/migrate_drupal/migrations/d7_entity_reference_translation.yml22
-rw-r--r--core/modules/migrate_drupal/src/MigrationConfigurationTrait.php6
-rw-r--r--core/modules/migrate_drupal/tests/src/Kernel/d6/FollowUpMigrationsTest.php2
-rw-r--r--core/modules/migrate_drupal/tests/src/Kernel/d7/FollowUpMigrationsTest.php2
6 files changed, 17 insertions, 44 deletions
diff --git a/core/modules/migrate_drupal/migrate_drupal.install b/core/modules/migrate_drupal/migrate_drupal.install
index ed60201..820bcdc 100644
--- a/core/modules/migrate_drupal/migrate_drupal.install
+++ b/core/modules/migrate_drupal/migrate_drupal.install
@@ -24,3 +24,10 @@ function migrate_drupal_update_8502() {
->set('follow_up_migration_tags', ['Follow-up migration'])
->save();
}
+
+/**
+ * Install migrate_drupal_multilingual since migrate_drupal is installed.
+ */
+function migrate_drupal_update_8601() {
+ \Drupal::service('module_installer')->install(['migrate_drupal_multilingual']);
+}
diff --git a/core/modules/migrate_drupal/migrations/d6_entity_reference_translation.yml b/core/modules/migrate_drupal/migrations/d6_entity_reference_translation.yml
deleted file mode 100644
index 3188820..0000000
--- a/core/modules/migrate_drupal/migrations/d6_entity_reference_translation.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-id: d6_entity_reference_translation
-label: Entity reference translations
-migration_tags:
- - Drupal 6
- - Follow-up migration
-deriver: Drupal\migrate_drupal\Plugin\migrate\EntityReferenceTranslationDeriver
-# Supported target types for entity reference translation migrations. The array
-# keys are the supported target types and the values are arrays of migrations
-# to lookup for the translated entity IDs.
-target_types:
- node:
- - d6_node_translation
-# The source plugin will be set by the deriver.
-source:
- plugin: empty
- key: default
- target: default
-# The process pipeline will be set by the deriver.
-process: []
-# The destination plugin will be set by the deriver.
-destination:
- plugin: null
diff --git a/core/modules/migrate_drupal/migrations/d7_entity_reference_translation.yml b/core/modules/migrate_drupal/migrations/d7_entity_reference_translation.yml
deleted file mode 100644
index 7e59a9a..0000000
--- a/core/modules/migrate_drupal/migrations/d7_entity_reference_translation.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-id: d7_entity_reference_translation
-label: Entity reference translations
-migration_tags:
- - Drupal 7
- - Follow-up migration
-deriver: Drupal\migrate_drupal\Plugin\migrate\EntityReferenceTranslationDeriver
-# Supported target types for entity reference translation migrations. The array
-# keys are the supported target types and the values are arrays of migrations
-# to lookup for the translated entity IDs.
-target_types:
- node:
- - d7_node_translation
-# The source plugin will be set by the deriver.
-source:
- plugin: empty
- key: default
- target: default
-# The process pipeline will be set by the deriver.
-process: []
-# The destination plugin will be set by the deriver.
-destination:
- plugin: null
diff --git a/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php b/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php
index 0aca5be..0349d87 100644
--- a/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php
+++ b/core/modules/migrate_drupal/src/MigrationConfigurationTrait.php
@@ -110,6 +110,12 @@ trait MigrationConfigurationTrait {
if (!empty(array_intersect($migration->getMigrationTags(), $this->getFollowUpMigrationTags()))) {
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 {
// @todo https://drupal.org/node/2681867 We should be able to validate
// the entire migration at this point.
diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d6/FollowUpMigrationsTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d6/FollowUpMigrationsTest.php
index e02254a..5225ce5 100644
--- a/core/modules/migrate_drupal/tests/src/Kernel/d6/FollowUpMigrationsTest.php
+++ b/core/modules/migrate_drupal/tests/src/Kernel/d6/FollowUpMigrationsTest.php
@@ -19,6 +19,8 @@ class FollowUpMigrationsTest extends MigrateNodeTestBase {
'content_translation',
'language',
'menu_ui',
+ // A requirement for d6_node_translation.
+ 'migrate_drupal_multilingual',
];
/**
diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d7/FollowUpMigrationsTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d7/FollowUpMigrationsTest.php
index b9b38c2..5417df4 100644
--- a/core/modules/migrate_drupal/tests/src/Kernel/d7/FollowUpMigrationsTest.php
+++ b/core/modules/migrate_drupal/tests/src/Kernel/d7/FollowUpMigrationsTest.php
@@ -26,6 +26,8 @@ class FollowUpMigrationsTest extends MigrateDrupal7TestBase {
'language',
'link',
'menu_ui',
+ // A requirement for translation migrations.
+ 'migrate_drupal_multilingual',
'node',
'taxonomy',
'telephone',