1 views_handler_filter_date.inc views_handler_filter_date::accept_exposed_input($input)

Do some minor translation of the exposed input

Overrides views_handler_filter_numeric::accept_exposed_input

File

core/modules/views/handlers/views_handler_filter_date.inc, line 125
Definition of views_handler_filter_date.

Class

views_handler_filter_date
Filter to handle dates stored as a timestamp.

Code

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

  // Store this because it will get overwritten.
  $type = $this->value['type'];
  $rc = parent::accept_exposed_input($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;
    }
  }
  elseif ($operators[$operator]['values'] == 2) {
    if ($this->value['min'] == '' || $this->value['max'] == '') {
      return FALSE;
    }
  }

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