MigrateUpgradeFormBase.php in Drupal 9
File
core/modules/migrate_drupal_ui/src/Form/MigrateUpgradeFormBase.php
View source
<?php
namespace Drupal\migrate_drupal_ui\Form;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Form\FormBase;
use Drupal\Core\Form\FormStateInterface;
use Drupal\Core\State\StateInterface;
use Drupal\Core\TempStore\PrivateTempStoreFactory;
use Drupal\migrate\Plugin\MigrationPluginManagerInterface;
use Drupal\migrate_drupal\MigrationConfigurationTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
abstract class MigrateUpgradeFormBase extends FormBase {
use MigrationConfigurationTrait;
protected $store;
protected $destinationSiteVersion;
public function __construct(ConfigFactoryInterface $config_factory, MigrationPluginManagerInterface $migration_plugin_manager, StateInterface $state, PrivateTempStoreFactory $tempstore_private) {
$this->configFactory = $config_factory;
$this->migrationPluginManager = $migration_plugin_manager;
$this->state = $state;
$this->store = $tempstore_private
->get('migrate_drupal_ui');
}
public static function create(ContainerInterface $container) {
return new static($container
->get('config.factory'), $container
->get('plugin.manager.migration'), $container
->get('state'), $container
->get('tempstore.private'));
}
public function buildForm(array $form, FormStateInterface $form_state) {
list($this->destinationSiteVersion) = explode('.', \Drupal::VERSION, 2);
$form = [];
$form['actions']['#type'] = 'actions';
$form['actions']['submit'] = [
'#type' => 'submit',
'#value' => $this
->getConfirmText(),
'#button_type' => 'primary',
'#weight' => 10,
];
return $form;
}
protected function restartUpgradeForm() {
$this->store
->set('step', 'overview');
return $this
->redirect('migrate_drupal_ui.upgrade');
}
protected abstract function getConfirmText();
}