You are here

public function CustomProductReport::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_report/src/Form/CustomProductReport.php, line 100

Class

CustomProductReport
Generates customized product reports.

Namespace

Drupal\uc_report\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $start_date = mktime(0, 0, 0, $form_state
    ->getValue([
    'start_date',
    'month',
  ]), $form_state
    ->getValue([
    'start_date',
    'day',
  ]), $form_state
    ->getValue([
    'start_date',
    'year',
  ]));
  $end_date = mktime(23, 59, 59, $form_state
    ->getValue([
    'end_date',
    'month',
  ]), $form_state
    ->getValue([
    'end_date',
    'day',
  ]), $form_state
    ->getValue([
    'end_date',
    'year',
  ]));
  $args = [
    'start_date' => $start_date,
    'end_date' => $end_date,
    'status' => implode(',', array_keys(array_filter($form_state
      ->getValue('status')))),
  ];
  $form_state
    ->setRedirect('uc_report.custom.products', $args);
}