function Date::validateExposed

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

Validate the exposed handler form.

Parameters

array $form: An alterable, associative array containing the structure of the form, passed by reference.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the 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);
}

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