You are here

public function OrderReportGenerateForm::submitForm in Commerce Reporting 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/OrderReportGenerateForm.php, line 89

Class

OrderReportGenerateForm
Profides a form for bulk generating order reports.

Namespace

Drupal\commerce_reports\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  $plugin_id = $values['plugin_id'];
  $batch = [
    'title' => $this
      ->t('Generating reports'),
    'progress_message' => '',
    'operations' => [
      [
        [
          get_class($this),
          'processBatch',
        ],
        [
          $plugin_id,
        ],
      ],
    ],
    'finished' => [
      $this,
      'finishBatch',
    ],
  ];
  batch_set($batch);
  $form_state
    ->setRedirect('commerce.configuration');
}