function SearchApiStringFilter::add_where in Search API Extended String Filter 7
1 call to SearchApiStringFilter::add_where()
File
- includes/
handler_filter_string.inc, line 336
Class
Code
function add_where($group, $clause) {
$args = func_get_args();
array_shift($args);
// ditch $group
array_shift($args);
// ditch $clause
// Expand an array of args if it came in.
if (count($args) == 1 && is_array(reset($args))) {
$args = current($args);
}
// Ensure all variants of 0 are actually 0. Thus '', 0 and NULL are all
// the default group.
if (empty($group)) {
$group = 0;
}
// Check for a group.
if (!isset($this->query->where[$group])) {
$this->query
->set_where_group('AND', $group);
}
// Add the clause and the args.
if (is_array($args)) {
$this->query->where[$group]['clauses'][] = $clause;
// we use array_values() here to prevent array_merge errors as keys from multiple
// sources occasionally collide.
$this->query->where[$group]['args'] = array_merge($this->query->where[$group]['args'], array_values($args));
}
}