You are here

function location_handler_filter_location_province::grovel_country in Location 7.5

Same name and namespace in other branches
  1. 6.3 handlers/location_handler_filter_location_province.inc \location_handler_filter_location_province::grovel_country()
  2. 7.3 handlers/location_handler_filter_location_province.inc \location_handler_filter_location_province::grovel_country()
  3. 7.4 handlers/location_handler_filter_location_province.inc \location_handler_filter_location_province::grovel_country()
2 calls to location_handler_filter_location_province::grovel_country()
location_handler_filter_location_province::query in handlers/location_handler_filter_location_province.inc
Add this filter to the query.
location_handler_filter_location_province::value_form in handlers/location_handler_filter_location_province.inc
Provide a simple textfield for equality

File

handlers/location_handler_filter_location_province.inc, line 68

Class

location_handler_filter_location_province
Filter on province.

Code

function grovel_country() {
  $country = variable_get('location_default_country', 'us');
  if (!empty($this->view->filter)) {
    foreach ($this->view->filter as $k => $v) {
      if ($v->table == 'location' && $v->field == 'country' && $v->options['relationship'] == $this->options['relationship']) {
        $country = $v->value;
        if (!empty($v->options['expose']['identifier'])) {
          if (isset($this->view->exposed_input[$v->options['expose']['identifier']])) {
            $country = $this->view->exposed_input[$v->options['expose']['identifier']];
          }
          $this->location_country_identifier = $v->options['expose']['identifier'];
        }
      }
    }
  }
  if ($country == '' || $country == 'All' || $country == '  ' || $country == 'xx') {

    // It's set to something nonsensical, reset to the default to prevent malfunctions.
    $country = variable_get('location_default_country', 'us');
  }
  $this->location_country = $country;
  return $country;
}