You are here

function views_handler_filter_date::accept_exposed_input in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 handlers/views_handler_filter_date.inc \views_handler_filter_date::accept_exposed_input()
  2. 7.3 handlers/views_handler_filter_date.inc \views_handler_filter_date::accept_exposed_input()

Do some minor translation of the exposed input

Overrides views_handler_filter_numeric::accept_exposed_input

File

handlers/views_handler_filter_date.inc, line 93

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'])) {
    $operator = $input[$this->options['expose']['operator']];
  }
  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;
}