You are here

function getlocations_fields_handler_filter_country::accept_exposed_input in Get Locations 7.2

Same name and namespace in other branches
  1. 7 modules/getlocations_fields/handlers/getlocations_fields_handler_filter_country.inc \getlocations_fields_handler_filter_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

modules/getlocations_fields/handlers/getlocations_fields_handler_filter_country.inc, line 89
getlocations_fields_handler_filter_country.inc @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Class

getlocations_fields_handler_filter_country
@file getlocations_fields_handler_filter_country.inc @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL

Code

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'])) {
        $this->value = array(
          $value,
        );
      }
    }
    else {
      return FALSE;
    }
  }
  return TRUE;
}