Same name and namespace in other branches
  1. 8.9.x core/modules/migrate_drupal_ui/src/Form/IncrementalForm.php \Drupal\migrate_drupal_ui\Form\IncrementalForm
  2. 9 core/modules/migrate_drupal_ui/src/Form/IncrementalForm.php \Drupal\migrate_drupal_ui\Form\IncrementalForm

Migrate Upgrade Incremental form.

@internal

Hierarchy

Expanded class hierarchy of IncrementalForm

1 string reference to 'IncrementalForm'
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/IncrementalForm.php, line 18

Namespace

Drupal\migrate_drupal_ui\Form
View source
class IncrementalForm extends MigrateUpgradeFormBase {

  /**
   * The date formatter service.
   *
   * @var \Drupal\Core\Datetime\DateFormatterInterface
   */
  protected $dateFormatter;

  /**
   * IncrementalForm constructor.
   *
   * @param \Drupal\Core\State\StateInterface $state
   *   The state service.
   * @param \Drupal\Core\Datetime\DateFormatterInterface $date_formatter
   *   The date formatter service.
   * @param \Drupal\Core\TempStore\PrivateTempStoreFactory $tempstore_private
   *   The private tempstore factory service.
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The config factory service.
   * @param \Drupal\migrate\Plugin\MigrationPluginManagerInterface $migration_plugin_manager
   *   The migration plugin manager service.
   */
  public function __construct(StateInterface $state, DateFormatterInterface $date_formatter, PrivateTempStoreFactory $tempstore_private, ConfigFactoryInterface $config_factory, MigrationPluginManagerInterface $migration_plugin_manager) {
    parent::__construct($config_factory, $migration_plugin_manager, $state, $tempstore_private);
    $this->dateFormatter = $date_formatter;
  }

  /**
   * {@inheritdoc}
   */
  public static function create(ContainerInterface $container) {
    return new static($container
      ->get('state'), $container
      ->get('date.formatter'), $container
      ->get('tempstore.private'), $container
      ->get('config.factory'), $container
      ->get('plugin.manager.migration'));
  }

  /**
   * {@inheritdoc}
   */
  public function getFormId() {
    return 'migrate_drupal_ui_incremental_form';
  }

  /**
   * {@inheritdoc}
   */
  public function buildForm(array $form, FormStateInterface $form_state) {

    // Get all the data needed for this form.
    $date_performed = $this->state
      ->get('migrate_drupal_ui.performed');

    // If data is missing or this is the wrong step, start over.
    if (!$date_performed || $this->store
      ->get('step') != 'incremental') {
      return $this
        ->restartUpgradeForm();
    }
    $form = parent::buildForm($form, $form_state);
    $form['#title'] = $this
      ->t('Upgrade');

    // @todo Add back support for rollbacks.
    //   https://www.drupal.org/node/2687849
    $form['upgrade_option_item'] = [
      '#type' => 'item',
      '#prefix' => $this
        ->t('An upgrade has already been performed on this site. To perform a new migration, create a clean and empty new install of Drupal @version. Rollbacks are not yet supported through the user interface. For more information, see the <a href=":url">upgrading handbook</a>.', [
        '@version' => $this->destinationSiteVersion,
        ':url' => 'https://www.drupal.org/upgrade/migrate',
      ]),
      '#description' => $this
        ->t('Last upgrade: @date', [
        '@date' => $this->dateFormatter
          ->format($date_performed),
      ]),
    ];
    return $form;
  }

  /**
   * {@inheritdoc}
   */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $this->store
      ->set('step', 'credential');
    $form_state
      ->setRedirect('migrate_drupal_ui.upgrade_credential');
  }

  /**
   * {@inheritdoc}
   */
  public function getConfirmText() {
    return $this
      ->t('Import new configuration and content from old site');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
DependencySerializationTrait::$_entityStorages protected property
DependencySerializationTrait::$_serviceIds protected property
DependencySerializationTrait::__sleep public function 2
DependencySerializationTrait::__wakeup public function 2
FormBase::$configFactory protected property The config factory. 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. 2
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.
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 47
IncrementalForm::$dateFormatter protected property The date formatter service.
IncrementalForm::buildForm public function Form constructor. Overrides MigrateUpgradeFormBase::buildForm
IncrementalForm::create public static function Instantiates a new instance of this class. Overrides MigrateUpgradeFormBase::create
IncrementalForm::getConfirmText public function Returns a caption for the button that confirms the action. Overrides MigrateUpgradeFormBase::getConfirmText
IncrementalForm::getFormId public function Returns a unique string identifying the form. Overrides FormInterface::getFormId
IncrementalForm::submitForm public function Form submission handler. Overrides FormInterface::submitForm
IncrementalForm::__construct public function IncrementalForm constructor. Overrides MigrateUpgradeFormBase::__construct
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. 8
MessengerTrait::messenger public function Gets the messenger. 8
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.
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.
StringTranslationTrait::$stringTranslation protected property The string translation service. 3
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. 1
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.