class ReviewForm
Same name in other branches
- 9 core/modules/migrate_drupal_ui/src/Form/ReviewForm.php \Drupal\migrate_drupal_ui\Form\ReviewForm
- 10 core/modules/migrate_drupal_ui/src/Form/ReviewForm.php \Drupal\migrate_drupal_ui\Form\ReviewForm
- 11.x core/modules/migrate_drupal_ui/src/Form/ReviewForm.php \Drupal\migrate_drupal_ui\Form\ReviewForm
Migrate Upgrade review form.
This confirmation form provides the user with a summary of all the modules enabled on the source site and whether they will be upgraded or not. Data from a module's .migrate_drupal.yml file and all the migration plugins (source, destination and field) for each enabled Drupal 8 module are used to decide the migration status for each enabled module on the source site.
The migration status displayed on the Review page is a list of all the enabled modules on the source site divided into two categories, those that will not be upgraded and those that will be upgraded. The intention is to provide the admin with enough information to decide if it is OK to proceed with the upgrade.
@internal
Hierarchy
- class \Drupal\Core\Form\FormBase implements \Drupal\Core\Form\FormInterface, \Drupal\Core\DependencyInjection\ContainerInjectionInterface uses \Drupal\Core\DependencyInjection\DependencySerializationTrait, \Drupal\Core\Routing\LinkGeneratorTrait, \Drupal\Core\Logger\LoggerChannelTrait, \Drupal\Core\Messenger\MessengerTrait, \Drupal\Core\Routing\RedirectDestinationTrait, \Drupal\Core\StringTranslation\StringTranslationTrait, \Drupal\Core\Routing\UrlGeneratorTrait
- class \Drupal\migrate_drupal_ui\Form\MigrateUpgradeFormBase extends \Drupal\Core\Form\FormBase uses \Drupal\migrate_drupal\MigrationConfigurationTrait
- class \Drupal\migrate_drupal_ui\Form\ReviewForm extends \Drupal\migrate_drupal_ui\Form\MigrateUpgradeFormBase
- class \Drupal\migrate_drupal_ui\Form\MigrateUpgradeFormBase extends \Drupal\Core\Form\FormBase uses \Drupal\migrate_drupal\MigrationConfigurationTrait
Expanded class hierarchy of ReviewForm
1 string reference to 'ReviewForm'
- migrate_drupal_ui.routing.yml in core/
modules/ migrate_drupal_ui/ migrate_drupal_ui.routing.yml - core/modules/migrate_drupal_ui/migrate_drupal_ui.routing.yml
File
-
core/
modules/ migrate_drupal_ui/ src/ Form/ ReviewForm.php, line 31
Namespace
Drupal\migrate_drupal_ui\FormView source
class ReviewForm extends MigrateUpgradeFormBase {
/**
* The migrations.
*
* @var \Drupal\migrate\Plugin\MigrationInterface[]
*/
protected $migrations;
/**
* Migration state service.
*
* @var \Drupal\migrate_drupal\MigrationState
*/
protected $migrationState;
/**
* ReviewForm constructor.
*
* @param \Drupal\Core\State\StateInterface $state
* The state service.
* @param \Drupal\migrate\Plugin\MigrationPluginManagerInterface $migration_plugin_manager
* The migration plugin manager service.
* @param \Drupal\Core\TempStore\PrivateTempStoreFactory $tempstore_private
* The private tempstore factory service.
* @param \Drupal\migrate_drupal\MigrationState $migrationState
* Migration state service.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The config factory service.
*/
public function __construct(StateInterface $state, MigrationPluginManagerInterface $migration_plugin_manager, PrivateTempStoreFactory $tempstore_private, MigrationState $migrationState, ConfigFactoryInterface $config_factory) {
parent::__construct($config_factory, $migration_plugin_manager, $state, $tempstore_private);
$this->migrationState = $migrationState;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
return new static($container->get('state'), $container->get('plugin.manager.migration'), $container->get('tempstore.private'), $container->get('migrate_drupal.migration_state'), $container->get('config.factory'));
}
/**
* {@inheritdoc}
*/
public function getFormId() {
return 'migrate_drupal_ui_review_form';
}
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state) {
// Get all the data needed for this form.
$version = $this->store
->get('version');
$this->migrations = $this->store
->get('migrations');
// Fetch the source system data at the first opportunity.
$system_data = $this->store
->get('system_data');
// If data is missing or this is the wrong step, start over.
if (!$version || !$this->migrations || !$system_data || $this->store
->get('step') != 'review') {
return $this->restartUpgradeForm();
}
$form = parent::buildForm($form, $form_state);
$form['#title'] = $this->t('What will be upgraded?');
$migrations = $this->migrationPluginManager
->createInstances(array_keys($this->store
->get('migrations')));
// Get the upgrade states for the source modules.
$display = $this->migrationState
->getUpgradeStates($version, $system_data, $migrations);
// Missing migrations.
$missing_module_list = [
'#type' => 'details',
'#open' => TRUE,
'#title' => $this->t('Modules that will not be upgraded'),
'#summary_attributes' => [
'id' => [
'error',
],
],
'#description' => $this->t("The new site is missing modules corresponding to the old site's modules. Unless they are installed prior to the upgrade, configuration and/or content needed by them will not be available on your new site. <a href=':review'>Read the checklist</a> to help decide what to do.", [
':review' => 'https://www.drupal.org/docs/8/upgrade/upgrade-using-web-browser#pre-upgrade-analysis',
]),
'#weight' => 2,
];
$missing_module_list['module_list'] = [
'#type' => 'table',
'#header' => [
$this->t('Drupal @version', [
'@version' => $version,
]),
$this->t('Drupal @version', [
'@version' => $this->destinationSiteVersion,
]),
],
];
$missing_count = 0;
if (isset($display[MigrationState::NOT_FINISHED])) {
foreach ($display[MigrationState::NOT_FINISHED] as $source_module => $destination_modules) {
$missing_count++;
// Get the migration status for this $source_module, if a module of the
// same name exists on the destination site.
$missing_module_list['module_list'][] = [
'source_module' => [
'#type' => 'html_tag',
'#tag' => 'span',
'#value' => $source_module,
'#attributes' => [
'class' => [
'upgrade-analysis-report__status-icon',
'upgrade-analysis-report__status-icon--error',
],
],
],
'destination_module' => [
'#plain_text' => $destination_modules,
],
];
}
}
// Available migrations.
$available_module_list = [
'#type' => 'details',
'#title' => $this->t('Modules that will be upgraded'),
'#summary_attributes' => [
'id' => [
'checked',
],
],
'#weight' => 4,
];
$available_module_list['module_list'] = [
'#type' => 'table',
'#header' => [
$this->t('Drupal @version', [
'@version' => $version,
]),
$this->t('Drupal @version', [
'@version' => $this->destinationSiteVersion,
]),
],
];
$available_count = 0;
if (isset($display[MigrationState::FINISHED])) {
foreach ($display[MigrationState::FINISHED] as $source_module => $destination_modules) {
$available_count++;
$available_module_list['module_list'][] = [
'source_module' => [
'#type' => 'html_tag',
'#tag' => 'span',
'#value' => $source_module,
'#attributes' => [
'class' => [
'upgrade-analysis-report__status-icon',
'upgrade-analysis-report__status-icon--checked',
],
],
],
'destination_module' => [
'#plain_text' => $destination_modules,
],
];
}
}
$counters = [];
$general_info = [];
if ($missing_count) {
$counters[] = [
'#theme' => 'status_report_counter',
'#amount' => $missing_count,
'#text' => $this->formatPlural($missing_count, 'Module will not be upgraded', 'Modules will not be upgraded'),
'#severity' => 'error',
'#weight' => 0,
];
$general_info[] = $missing_module_list;
}
if ($available_count) {
$counters[] = [
'#theme' => 'status_report_counter',
'#amount' => $available_count,
'#text' => $this->formatPlural($available_count, 'Module will be upgraded', 'Modules will be upgraded'),
'#severity' => 'checked',
'#weight' => 1,
];
$general_info[] = $available_module_list;
}
$form['status_report_page'] = [
'#theme' => 'status_report_page',
'#counters' => $counters,
'#general_info' => $general_info,
];
$form['#attached']['library'][] = 'migrate_drupal_ui/base';
return $form;
}
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
$config['source_base_path'] = $this->store
->get('source_base_path');
$batch = [
'title' => $this->t('Running upgrade'),
'progress_message' => '',
'operations' => [
[
[
MigrateUpgradeImportBatch::class,
'run',
],
[
array_keys($this->migrations),
$config,
],
],
],
'finished' => [
MigrateUpgradeImportBatch::class,
'finished',
],
];
batch_set($batch);
$form_state->setRedirect('<front>');
$this->store
->set('step', 'overview');
$this->state
->set('migrate_drupal_ui.performed', REQUEST_TIME);
}
/**
* {@inheritdoc}
*/
public function getConfirmText() {
return $this->t('Perform upgrade');
}
}
Members
Title Sort descending | Deprecated | Modifiers | Object type | Summary | Overriden Title | Overrides |
---|---|---|---|---|---|---|
DependencySerializationTrait::$_entityStorages | protected | property | An array of entity type IDs keyed by the property name of their storages. | |||
DependencySerializationTrait::$_serviceIds | protected | property | An array of service IDs keyed by property name used for serialization. | |||
DependencySerializationTrait::__sleep | public | function | 1 | |||
DependencySerializationTrait::__wakeup | public | function | 2 | |||
FormBase::$requestStack | protected | property | The request stack. | 1 | ||
FormBase::$routeMatch | protected | property | The route match. | |||
FormBase::config | protected | function | Retrieves a configuration object. | |||
FormBase::configFactory | protected | function | Gets the config factory for this form. | 3 | ||
FormBase::container | private | function | Returns the service container. | |||
FormBase::currentUser | protected | function | Gets the current user. | |||
FormBase::getRequest | protected | function | Gets the request object. | |||
FormBase::getRouteMatch | protected | function | Gets the route match. | |||
FormBase::logger | protected | function | Gets the logger for a specific channel. | |||
FormBase::redirect | protected | function | Returns a redirect response object for the specified route. | Overrides UrlGeneratorTrait::redirect | ||
FormBase::resetConfigFactory | public | function | Resets the configuration factory. | |||
FormBase::setConfigFactory | public | function | Sets the config factory for this form. | |||
FormBase::setRequestStack | public | function | Sets the request stack object to use. | |||
FormBase::validateForm | public | function | Form validation handler. | Overrides FormInterface::validateForm | 73 | |
LinkGeneratorTrait::$linkGenerator | protected | property | The link generator. | 1 | ||
LinkGeneratorTrait::getLinkGenerator | Deprecated | protected | function | Returns the link generator. | ||
LinkGeneratorTrait::l | Deprecated | protected | function | Renders a link to a route given a route name and its parameters. | ||
LinkGeneratorTrait::setLinkGenerator | Deprecated | public | function | Sets the link generator service. | ||
LoggerChannelTrait::$loggerFactory | protected | property | The logger channel factory service. | |||
LoggerChannelTrait::getLogger | protected | function | Gets the logger for a specific channel. | |||
LoggerChannelTrait::setLoggerFactory | public | function | Injects the logger channel factory. | |||
MessengerTrait::$messenger | protected | property | The messenger. | 17 | ||
MessengerTrait::messenger | public | function | Gets the messenger. | 17 | ||
MessengerTrait::setMessenger | public | function | Sets the messenger. | |||
MigrateUpgradeFormBase::$destinationSiteVersion | protected | property | The destination site major version. | |||
MigrateUpgradeFormBase::$store | protected | property | Private temporary storage. | |||
MigrateUpgradeFormBase::restartUpgradeForm | protected | function | Helper to redirect to the Overview form. | |||
MigrationConfigurationTrait::$configFactory | protected | property | The config factory service. | |||
MigrationConfigurationTrait::$followUpMigrationTags | protected | property | The follow-up migration tags. | |||
MigrationConfigurationTrait::$migrationPluginManager | protected | property | The migration plugin manager service. | |||
MigrationConfigurationTrait::$state | protected | property | The state service. | |||
MigrationConfigurationTrait::createDatabaseStateSettings | protected | function | Creates the necessary state entries for SqlBase::getDatabase() to work. | |||
MigrationConfigurationTrait::getConfigFactory | protected | function | Gets the config factory service. | |||
MigrationConfigurationTrait::getConnection | protected | function | Gets the database connection for the source Drupal database. | |||
MigrationConfigurationTrait::getFollowUpMigrationTags | protected | function | Returns the follow-up migration tags. | |||
MigrationConfigurationTrait::getLegacyDrupalVersion | public static | function | Determines what version of Drupal the source database contains. | |||
MigrationConfigurationTrait::getMigrationPluginManager | protected | function | Gets the migration plugin manager service. | |||
MigrationConfigurationTrait::getMigrations | protected | function | Gets the migrations for import. | |||
MigrationConfigurationTrait::getState | protected | function | Gets the state service. | |||
MigrationConfigurationTrait::getSystemData | protected | function | Gets the system data from the system table of the source Drupal database. | |||
RedirectDestinationTrait::$redirectDestination | protected | property | The redirect destination service. | 1 | ||
RedirectDestinationTrait::getDestinationArray | protected | function | Prepares a 'destination' URL query parameter for use with \Drupal\Core\Url. | |||
RedirectDestinationTrait::getRedirectDestination | protected | function | Returns the redirect destination service. | |||
RedirectDestinationTrait::setRedirectDestination | public | function | Sets the redirect destination service. | |||
ReviewForm::$migrations | protected | property | The migrations. | |||
ReviewForm::$migrationState | protected | property | Migration state service. | |||
ReviewForm::buildForm | public | function | Form constructor. | Overrides MigrateUpgradeFormBase::buildForm | ||
ReviewForm::create | public static | function | Instantiates a new instance of this class. | Overrides MigrateUpgradeFormBase::create | ||
ReviewForm::getConfirmText | public | function | Returns a caption for the button that confirms the action. | Overrides MigrateUpgradeFormBase::getConfirmText | ||
ReviewForm::getFormId | public | function | Returns a unique string identifying the form. | Overrides FormInterface::getFormId | ||
ReviewForm::submitForm | public | function | Form submission handler. | Overrides FormInterface::submitForm | ||
ReviewForm::__construct | public | function | ReviewForm constructor. | Overrides MigrateUpgradeFormBase::__construct | ||
StringTranslationTrait::$stringTranslation | protected | property | The string translation service. | |||
StringTranslationTrait::formatPlural | protected | function | Formats a string containing a count of items. | |||
StringTranslationTrait::getNumberOfPlurals | protected | function | Returns the number of plurals supported by a given language. | |||
StringTranslationTrait::getStringTranslation | protected | function | Gets the string translation service. | |||
StringTranslationTrait::setStringTranslation | public | function | Sets the string translation service to use. | 2 | ||
StringTranslationTrait::t | protected | function | Translates a string to the current language or to a given language. | |||
UrlGeneratorTrait::$urlGenerator | protected | property | The url generator. | |||
UrlGeneratorTrait::getUrlGenerator | Deprecated | protected | function | Returns the URL generator service. | ||
UrlGeneratorTrait::setUrlGenerator | Deprecated | public | function | Sets the URL generator service. | ||
UrlGeneratorTrait::url | Deprecated | protected | function | Generates a URL or path for a specific route based on the given parameters. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.