You are here

public function W3CValidatorOperationConfirmForm::submitForm in W3C Validator 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/W3CValidatorOperationConfirmForm.php, line 66

Class

W3CValidatorOperationConfirmForm
Provides a confirmation form before clearing out the logs.

Namespace

Drupal\w3c_validator\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $batch = [
    'title' => $this
      ->t('Validating pages'),
    'operations' => [
      [
        [
          $this->w3cProcessor,
          'validateAllPages',
        ],
        [],
      ],
    ],
    'finished' => 'getCancelUrl',
    'init_message' => $this
      ->t('Starting validator...'),
    'progress_message' => $this
      ->t('Processed @current out of @total.'),
    'error_message' => $this
      ->t('Error while validating pages.'),
  ];
  batch_set($batch);
  $form_state
    ->setRedirect('w3c_validator.overview');
}