You are here

public function RunForm::submitForm in Security Review 8

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/RunForm.php, line 75

Class

RunForm
Provides implementation for the Run form.

Namespace

Drupal\security_review\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $batch = [
    'operations' => [],
    'finished' => '_security_review_batch_run_finished',
    'title' => $this
      ->t('Performing Security Review'),
    'init_message' => $this
      ->t('Security Review is starting.'),
    'progress_message' => $this
      ->t('Progress @current out of @total.'),
    'error_message' => $this
      ->t('An error occurred. Rerun the process or consult the logs.'),
  ];
  foreach ($this->checklist
    ->getEnabledChecks() as $check) {
    $batch['operations'][] = [
      '_security_review_batch_run_op',
      [
        $check,
      ],
    ];
  }
  batch_set($batch);
}