You are here

function getlocations_fields_handler_argument_country::query in Get Locations 7.2

Same name and namespace in other branches
  1. 7 modules/getlocations_fields/handlers/getlocations_fields_handler_argument_country.inc \getlocations_fields_handler_argument_country::query()

Set up the query for this argument.

The argument sent may be found at $this->argument.

Overrides views_handler_argument::query

File

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

Class

getlocations_fields_handler_argument_country
Argument handler to accept country code

Code

function query($group_by = FALSE) {
  $value = FALSE;
  if ($this->options['type'] == 'country' && isset($this->argument)) {
    $value = drupal_strtolower($this->argument);

    // check this
    if (!getlocations_get_country_name($value)) {
      $value = FALSE;
    }
  }
  if ($value) {
    $alias = $this->table_alias ? $this->table_alias : $this->table;
    $field = $alias . '.' . $this->real_field;
    $operator = '=';
    $this->query
      ->add_where($group_by, $field, $value, $operator);
  }
}