You are here

public function location_handler_filter_location_country::accept_exposed_input in Location 7.3

Same name and namespace in other branches
  1. 6.3 handlers/location_handler_filter_location_country.inc \location_handler_filter_location_country::accept_exposed_input()
  2. 7.5 handlers/location_handler_filter_location_country.inc \location_handler_filter_location_country::accept_exposed_input()

Check to see if input from the exposed filters should change the behavior.

Overrides views_handler_filter_in_operator::accept_exposed_input

File

handlers/location_handler_filter_location_country.inc, line 116
Filter on country.

Class

location_handler_filter_location_country

Code

public function accept_exposed_input($input) {
  if (empty($this->options['exposed'])) {
    return TRUE;
  }
  if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator_id']) && isset($input[$this->options['expose']['operator_id']])) {
    $this->operator = $input[$this->options['expose']['operator_id']];
  }
  if (!empty($this->options['expose']['identifier'])) {
    $value = $input[$this->options['expose']['identifier']];
    if (empty($this->options['expose']['required'])) {
      if ($value == 'All' || $value === array()) {
        if (empty($this->options['value']) || !empty($this->options['value']) && empty($this->options['expose']['reduce'])) {
          return FALSE;
        }
        else {
          $value = $this->options['value'];
        }
      }
      if (!empty($this->always_multiple) && $value === '') {
        return FALSE;
      }
    }
    if (isset($value)) {
      $this->value = $value;
      if (empty($this->always_multiple) && empty($this->options['expose']['multiple']) && !is_array($value)) {
        $this->value = array(
          $value,
        );
      }
    }
    else {
      return FALSE;
    }
  }
  return TRUE;
}