function Date::validateOptionsForm

Same name and namespace in other branches
  1. 8.9.x core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date::validateOptionsForm()
  2. 10 core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date::validateOptionsForm()
  3. 11.x core/modules/views/src/Plugin/views/filter/Date.php \Drupal\views\Plugin\views\filter\Date::validateOptionsForm()

Overrides FilterPluginBase::validateOptionsForm

File

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

Class

Date
Filter to handle dates stored as a timestamp.

Namespace

Drupal\views\Plugin\views\filter

Code

public function validateOptionsForm(&$form, FormStateInterface $form_state) {
    parent::validateOptionsForm($form, $form_state);
    if (!empty($this->options['exposed']) && $form_state->isValueEmpty([
        'options',
        'expose',
        'required',
    ])) {
        // Who cares what the value is if it's exposed and non-required.
        return;
    }
    $this->validateValidTime($form['value'], $form_state, $form_state->getValue([
        'options',
        'operator',
    ]), $form_state->getValue([
        'options',
        'value',
    ]));
}

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