You are here

public function location_handler_filter_location_province::grovel_country in Location 7.3

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.5 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()

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 116
Filter on province.

Class

location_handler_filter_location_province

Code

public 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->options['relationship'] == $this->options['relationship']) {
        if ($v->field == 'country' || strpos($v->field, 'distance') && $v->options['origin'] != 'postal_default') {
          $country = strpos($v->field, 'distance') ? $v->value['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' || empty($country)) {

    // 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;
}