interdiff impossible; taking evasive action reverted: --- b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php +++ a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php @@ -2,7 +2,6 @@ namespace Drupal\migrate_drupal_ui\Form; -use Drupal\Component\Plugin\Exception\PluginNotFoundException; use Drupal\Core\Datetime\DateFormatterInterface; use Drupal\Core\Form\ConfirmFormBase; use Drupal\Core\Form\FormStateInterface; @@ -467,32 +466,6 @@ ksort($table_data[$source_module]); } - // Now get the field migrations. - $field_types = \Drupal::service('plugin.manager.field.field_type')->getDefinitions(); - /** @var \Drupal\migrate_drupal\Plugin\MigrateFieldPluginManager $field_plugin_manager */ - $field_plugin_manager = \Drupal::service('plugin.manager.migrate.field'); - /** @var \Drupal\Core\Extension\ModuleHandlerInterface $module_handler */ - $module_handler = \Drupal::service('module_handler'); - $field_plugin_ids = []; - $migrated_field_table_data = []; - foreach ($field_types as $field_type => $value) { - try { - $plugin_id = $field_plugin_manager->getPluginIdFromFieldType($field_type, ['core' => $version]); - $field_def = $field_plugin_manager->getDefinition($plugin_id); - $source_module = $field_def['source_module']; - $destination_module = $field_def['destination_module']; - $migration_id = 'field'; - if (($destination_module == 'core') || $module_handler->moduleExists($destination_module)) { - $migrated_field_table_data[$source_module][$destination_module][$migration_id] = $plugin_id . '_field'; - } - $field_plugin_ids[] = $plugin_id; - } - catch (PluginNotFoundException $ex) { - continue; - } - } - $table_data = array_merge($table_data, $migrated_field_table_data); - // Fetch the system data at the first opportunity. $system_data = $form_state->get('system_data'); $unmigrated_source_modules = array_diff_key($system_data['module'], $table_data); @@ -587,8 +560,7 @@ ], ], 'finished' => [ + MigrateUpgradeImportBatch::class, 'finished', - MigrateUpgradeImportBatch::class, - 'finished', ], ]; batch_set($batch); unchanged: --- a/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php +++ b/core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeForm.php @@ -2,13 +2,16 @@ namespace Drupal\migrate_drupal_ui\Form; +use Drupal\Component\Plugin\Exception\PluginNotFoundException; use Drupal\Core\Datetime\DateFormatterInterface; +use Drupal\Core\Extension\ModuleHandlerInterface; use Drupal\Core\Form\ConfirmFormBase; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Render\RendererInterface; use Drupal\Core\State\StateInterface; use Drupal\Core\Url; use Drupal\migrate\Plugin\MigrationPluginManagerInterface; +use Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface; use Drupal\migrate_drupal_ui\Batch\MigrateUpgradeImportBatch; use Drupal\migrate_drupal\MigrationConfigurationTrait; use Symfony\Component\DependencyInjection\ContainerInterface; @@ -49,6 +52,20 @@ class MigrateUpgradeForm extends ConfirmFormBase { protected $pluginManager; /** + * The field migrate plugin manager. + * + * @var \Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface + */ + protected $fieldPluginManager; + + /** + * The modue handler. + * + * @var \Drupal\Core\Extension\ModuleHandlerInterface + */ + protected $moduleHandler; + + /** * Constructs the MigrateUpgradeForm. * * @param \Drupal\Core\State\StateInterface $state @@ -59,12 +76,18 @@ class MigrateUpgradeForm extends ConfirmFormBase { * The renderer service. * @param \Drupal\migrate\Plugin\MigrationPluginManagerInterface $plugin_manager * The migration plugin manager. + * @param \Drupal\migrate_drupal\Plugin\MigrateFieldPluginManagerInterface $field_plugin_manager + * The field plugin manager. + * @param \Drupal\Core\Extension\ModuleHandlerInterface $module_handler + * The ID map migration plugin manager. */ - public function __construct(StateInterface $state, DateFormatterInterface $date_formatter, RendererInterface $renderer, MigrationPluginManagerInterface $plugin_manager) { + public function __construct(StateInterface $state, DateFormatterInterface $date_formatter, RendererInterface $renderer, MigrationPluginManagerInterface $plugin_manager, MigrateFieldPluginManagerInterface $field_plugin_manager, ModuleHandlerInterface $module_handler) { $this->state = $state; $this->dateFormatter = $date_formatter; $this->renderer = $renderer; $this->pluginManager = $plugin_manager; + $this->fieldPluginManager = $field_plugin_manager; + $this->moduleHandler = $module_handler; } /** @@ -75,7 +98,9 @@ public static function create(ContainerInterface $container) { $container->get('state'), $container->get('date.formatter'), $container->get('renderer'), - $container->get('plugin.manager.migration') + $container->get('plugin.manager.migration'), + $container->get('plugin.manager.migrate.field'), + $container->get('module_handler') ); } @@ -459,6 +484,25 @@ public function buildConfirmForm(array $form, FormStateInterface $form_state) { $table_data[$source_module][$destination_module][$migration_id] = $migration->label(); } } + + // Now get the field migrations. + $field_types = \Drupal::service('plugin.manager.field.field_type')->getDefinitions(); + foreach ($field_types as $field_type => $value) { + try { + $plugin_id = $this->fieldPluginManager->getPluginIdFromFieldType($field_type, ['core' => $version]); + $field_def = $this->fieldPluginManager->getDefinition($plugin_id); + $source_module = $field_def['source_module']; + $destination_module = $field_def['destination_module']; + $migration_id = 'field_' . $plugin_id; + if (($destination_module == 'core') || $this->moduleHandler->moduleExists($destination_module)) { + $table_data[$source_module][$destination_module][$migration_id] = $migration_id; + } + } + catch (PluginNotFoundException $ex) { + continue; + } + } + // Sort the table by source module names and within that destination // module names. ksort($table_data);