public function location_handler_argument_location_province::query in Location 7.3
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
- handlers/
location_handler_argument_location_province.inc, line 39 - Argument handler to accept a province code or name.
Class
Code
public function query($group_by = FALSE) {
$this
->ensure_my_table();
if (!empty($this->options['break_phrase'])) {
if ($this->argument != '') {
$this->value = explode(',', $this->argument);
}
$this->operator = 'or';
}
else {
$this->value = array(
$this->argument,
);
$this->operator = 'or';
}
if (count($this->value) > 1) {
$operator = empty($this->options['not']) ? 'IN' : 'NOT IN';
$placeholders = '"' . implode('", "', $this->value) . '"';
$this->query
->add_where(0, "{$this->table_alias}.{$this->real_field} {$operator} ({$placeholders})", $this->value);
}
else {
$operator = empty($this->options['not']) ? '=' : '!=';
$this->query
->add_where(0, "{$this->table_alias}.{$this->real_field} {$operator}", $this->argument);
}
}