function Date::validateExposed

Same name in other branches
  1. 8.9.x 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()
  3. 11.x core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date::validateExposed()

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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.