You are here

public function DateFilter::submitForm in Visitors 8.2

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

1 call to DateFilter::submitForm()
Referers::submitForm in src/Form/Referers.php
Form submission handler.
1 method overrides DateFilter::submitForm()
Referers::submitForm in src/Form/Referers.php
Form submission handler.

File

src/Form/DateFilter.php, line 132

Class

DateFilter

Namespace

Drupal\visitors\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $from = $form_state
    ->getValue('from');
  $to = $form_state
    ->getValue('to');
  $_SESSION['visitors_from'] = array(
    'month' => $from
      ->format('n'),
    'day' => $from
      ->format('j'),
    'year' => $from
      ->format('Y'),
  );
  $_SESSION['visitors_to'] = array(
    'month' => $to
      ->format('n'),
    'day' => $to
      ->format('j'),
    'year' => $to
      ->format('Y'),
  );
}