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 @@ -60,7 +60,7 @@ protected $fieldPluginManager; /** - * The modue handler. + * The module handler. * * @var \Drupal\Core\Extension\ModuleHandlerInterface */ @@ -465,7 +465,12 @@ } /** - * Confirmation form for missing migrations, etc. + * Confirmation form showing available and missing migration paths. + * + * The confirmation form uses the source_module and destination_module + * properties on the source, destination and field plugins as well as the + * system data from the source to determine if there is a migration path for + * each module in the source. * * @param array $form * An associative array containing the structure of the form. @@ -482,8 +487,9 @@ $form['actions']['submit']['#value'] = $this->t('Perform upgrade'); $version = $form_state->get('version'); - $migrations = $this->getMigrations('migrate_drupal_' . $version, $version); + // Get the source_module and destination_module for each migration. + $migrations = $this->getMigrations('migrate_drupal_' . $version, $version); $table_data = []; foreach ($migrations as $migration) { $migration_id = $migration->getPluginId(); @@ -501,50 +507,19 @@ } } - // Get all the field types from the source database using the source - // plugin in the field migration. - $field_types = []; - $definition = [ - 'source' => [ - 'ignore_map' => TRUE, - 'plugin' => 'd' . $version . '_field', - ], - 'destination' => [ - 'plugin' => 'null', - ], - ]; - try { - $source_plugin = \Drupal::service('plugin.manager.migration') - ->createStubMigration($definition) - ->getSourcePlugin(); - $source_plugin->checkRequirements(); - - foreach ($source_plugin as $row) { - $field_types[] = $row->getSourceProperty('type'); + // Get the source_module and destination_module from the field plugins. + $definitions = $this->fieldPluginManager->getDefinitions(); + foreach ($definitions as $definition) { + $source_module = $this->fieldPluginManager->getSourceModule($definition); + if (!$source_module) { + drupal_set_message($this->t('Source module not found for field plugin @id.', ['@id' => $definition['id']]), 'error'); } - $field_types = array_unique($field_types); - } - catch (RequirementsException $e) { - // If checkRequirements() failed then the field module did not exist and - // we do not have any fields. Therefore, $field_types will be empty below. - } - - // For each field type in the source get the source_module and the - // destination_module from the relevant field plugin. - foreach ($field_types as $field_type) { - try { - $plugin_id = $this->fieldPluginManager->getPluginIdFromFieldType($field_type, ['core' => $version]); - $definition = $this->fieldPluginManager->getDefinition($plugin_id); - $source_module = $this->fieldPluginManager->getSourceModule($definition); - $destination_module = $this->fieldPluginManager->getDestinationModule($definition); - if (($destination_module == 'core') || $this->moduleHandler->moduleExists($destination_module)) { - $field_plugin_id = $definition['id']; - $table_data[$source_module][$destination_module][$definition['id']] = $field_plugin_id; - } + $destination_module = $this->fieldPluginManager->getDestinationModule($definition); + if (!$destination_module) { + drupal_set_message($this->t('Destination module not found for field plugin @mid.', ['@id' => $definition['id']]), 'error'); } - catch (PluginNotFoundException $ex) { - // If checkRequirements() failed then there is no field migration for - // this field type. + if ($source_module && $destination_module) { + $table_data[$source_module][$destination_module][$definition['id']] = $definition['id']; } }