You are here

public function Date::validateOptionsForm 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::validateOptionsForm()

Simple validate handler.

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',
  ]));
}