*/
trait MigrationConfigurationTrait {
+ /**
+ * The follow-up migration tags.
+ *
+ * @var string[]
+ */
+ protected $followUpMigrationTags;
+
/**
* Gets the database connection for the source Drupal database.
*
$all_migrations = $plugin_manager->createInstancesByTag($version_tag);
$migrations = [];
foreach ($all_migrations as $migration) {
+ // Skip migrations tagged with any of the follow-up migration tags. They
+ // will be derived and executed after the migrations on which they depend
+ // have been successfully executed.
+ // @see Drupal\migrate_drupal\Plugin\MigrationWithFollowUpInterface
+ 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.
return $migrations;
}
+ /**
+ * Returns the follow-up migration tags.
+ *
+ * @return string[]
+ */
+ protected function getFollowUpMigrationTags() {
+ if ($this->followUpMigrationTags === NULL) {
+ $this->followUpMigrationTags = \Drupal::configFactory()
+ ->get('migrate_drupal.settings')
+ ->get('follow_up_migration_tags') ?: [];
+ }
+ return $this->followUpMigrationTags;
+ }
+
/**
* Determines what version of Drupal the source database contains.
*