You are here

public function Date::validateExposed in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date::validateExposed()
  2. 10 core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date::validateExposed()

Validate the exposed handler form.

Overrides HandlerBase::validateExposed

File

core/modules/views/src/Plugin/views/filter/Date.php, line 54

Class

Date
Filter to handle dates stored as a timestamp.

Namespace

Drupal\views\Plugin\views\filter

Code

public function validateExposed(&$form, FormStateInterface $form_state) {
  if (empty($this->options['exposed'])) {
    return;
  }
  if (empty($this->options['expose']['required'])) {

    // Who cares what the value is if it's exposed and non-required.
    return;
  }
  $value =& $form_state
    ->getValue($this->options['expose']['identifier']);
  if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator_id'])) {
    $operator =& $form_state
      ->getValue($this->options['expose']['operator_id']);
  }
  else {
    $operator = $this->operator;
  }
  $this
    ->validateValidTime($this->options['expose']['identifier'], $form_state, $operator, $value);
}