function og_views_break_phrase in Organic groups 5
Same name and namespace in other branches
- 5.8 og_views.inc \og_views_break_phrase()
- 5.3 og_views.inc \og_views_break_phrase()
- 5.7 og_views.inc \og_views_break_phrase()
Helper function for filter and argument which accepts + or , delimited integers like taxonomy urls. Performs modifications on $query object. A wrapper around views_break_phrase().
Return value
void
2 calls to og_views_break_phrase()
File
- ./
og_views.inc, line 1443
Code
function og_views_break_phrase($string, &$query) {
list($and_or, $gids) = _views_break_phrase($string);
$and_or = strtoupper($and_or);
// analogous to taxonomy AND/OR query. see views_taxonomy.inc
if ($and_or == 'OR') {
$query
->ensure_table('og_ancestry');
$cond = array_fill(0, count($gids), "og_ancestry.group_nid = %d");
$query
->add_where(implode(" {$and_or} ", $cond), $gids);
}
else {
foreach ((array) $gids as $gid) {
$num = $query
->add_table('og_ancestry');
$tablename = $query
->get_table_name('og_ancestry', $num);
$query
->add_where("{$tablename}.group_nid = %d", $gid);
}
}
if ($GLOBALS['current_view']->build_type == 'page' && is_numeric($gids[0])) {
$node = node_load($gids[0]);
og_set_group_context($node);
}
}