You are here

public function UpdaterForm::submitForm in Automatic Updates 8.2

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

src/Form/UpdaterForm.php, line 236

Class

UpdaterForm
Defines a form to update Drupal core.

Namespace

Drupal\automatic_updates\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $batch = (new BatchBuilder())
    ->setTitle($this
    ->t('Downloading updates'))
    ->setInitMessage($this
    ->t('Preparing to download updates'))
    ->addOperation([
    BatchProcessor::class,
    'begin',
  ], [
    $form_state
      ->getValue('update_version'),
  ])
    ->addOperation([
    BatchProcessor::class,
    'stage',
  ])
    ->setFinishCallback([
    BatchProcessor::class,
    'finishStage',
  ])
    ->toArray();
  batch_set($batch);
}