You are here

public function ParametersForm::submitForm in Ubercart 8.4

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

uc_tax_report/src/Form/ParametersForm.php, line 89

Class

ParametersForm
Form to customize parameters on the tax report.

Namespace

Drupal\uc_tax_report\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Build the start and end dates from the form.
  $start_date = $form_state
    ->getValue('start_date')
    ->setTime(0, 0, 0)
    ->getTimestamp();
  $end_date = $form_state
    ->getValue('end_date')
    ->setTime(23, 59, 59)
    ->getTimestamp();
  $args = [
    'start_date' => $start_date,
    'end_date' => $end_date,
    'statuses' => implode(',', array_keys($form_state
      ->getValue('statuses'))),
  ];
  $form_state
    ->setRedirect('uc_tax_report.reports', $args);
}