function getlocations_fields_handler_argument_glid::query in Get Locations 7.2
Same name and namespace in other branches
- 7 modules/getlocations_fields/handlers/getlocations_fields_handler_argument_glid.inc \getlocations_fields_handler_argument_glid::query()
Set up the query for this argument.
The argument sent may be found at $this->argument.
Parameters
bool $group_by: Whether the query uses a group-by.
Overrides views_handler_argument::query
File
- modules/
getlocations_fields/ handlers/ getlocations_fields_handler_argument_glid.inc, line 95 - getlocations_fields_handler_argument_glid.inc @author Bob Hutchinson http://drupal.org/user/52366 @copyright GNU GPL
Class
- getlocations_fields_handler_argument_glid
- Argument handler to accept glid
Code
function query($group_by = FALSE) {
$this
->ensure_my_table();
if (!empty($this->options['break_phrase'])) {
views_break_phrase($this->argument, $this);
}
else {
$this->value = array(
$this->argument,
);
}
$placeholder = $this
->placeholder();
$null_check = empty($this->options['not']) ? '' : "OR {$this->table_alias}.{$this->real_field} IS NULL";
if (count($this->value) > 1) {
$operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
$this->query
->add_where_expression(0, "{$this->table_alias}.{$this->real_field} {$operator}({$placeholder}) {$null_check}", array(
$placeholder => $this->value,
));
}
else {
$operator = empty($this->options['not']) ? '=' : '!=';
$this->query
->add_where_expression(0, "{$this->table_alias}.{$this->real_field} {$operator} {$placeholder} {$null_check}", array(
$placeholder => $this->argument,
));
}
}