public function Date::acceptExposedInput

Do some minor translation of the exposed input

Overrides Numeric::acceptExposedInput

File

drupal/core/modules/views/lib/Drupal/views/Plugin/views/filter/Date.php, line 135
Definition of Drupal\views\Plugin\views\filter\Date.

Class

Date
Filter to handle dates stored as a timestamp.

Namespace

Drupal\views\Plugin\views\filter

Code

public function acceptExposedInput($input) {
  if (empty($this->options['exposed'])) {
    return TRUE;
  }

  // Store this because it will get overwritten.
  $type = $this->value['type'];
  $rc = parent::acceptExposedInput($input);

  // Don't filter if value(s) are empty.
  $operators = $this
    ->operators();
  if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator_id'])) {
    $operator = $input[$this->options['expose']['operator_id']];
  }
  else {
    $operator = $this->operator;
  }
  if ($operators[$operator]['values'] == 1) {
    if ($this->value['value'] == '') {
      return FALSE;
    }
  }
  else {
    if ($this->value['min'] == '' || $this->value['max'] == '') {
      return FALSE;
    }
  }

  // restore what got overwritten by the parent.
  $this->value['type'] = $type;
  return $rc;
}