function IncrementalForm::buildForm

Same name in other branches
  1. 9 core/modules/migrate_drupal_ui/src/Form/IncrementalForm.php \Drupal\migrate_drupal_ui\Form\IncrementalForm::buildForm()
  2. 8.9.x core/modules/migrate_drupal_ui/src/Form/IncrementalForm.php \Drupal\migrate_drupal_ui\Form\IncrementalForm::buildForm()
  3. 10 core/modules/migrate_drupal_ui/src/Form/IncrementalForm.php \Drupal\migrate_drupal_ui\Form\IncrementalForm::buildForm()

Overrides MigrateUpgradeFormBase::buildForm

File

core/modules/migrate_drupal_ui/src/Form/IncrementalForm.php, line 69

Class

IncrementalForm
Migrate Upgrade Incremental form.

Namespace

Drupal\migrate_drupal_ui\Form

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.