You are here

public function views_handler_filter_date::accept_exposed_input in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 handlers/views_handler_filter_date.inc \views_handler_filter_date::accept_exposed_input()
  2. 6.2 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 138
Definition of views_handler_filter_date.

Class

views_handler_filter_date
Filter to handle dates stored as a timestamp.

Code

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

  // Store this because it will get overwritten.
  $type = '';
  if (is_array($this->value)) {
    $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.
  if (is_array($this->value)) {
    $this->value['type'] = $type;
  }
  return $rc;
}