function og_subgroups_handler_argument_gid in Subgroups for Organic groups 5
Same name and namespace in other branches
- 5.4 og_subgroups.views.inc \og_subgroups_handler_argument_gid()
Custom argument for filtering by one or more group nids.
1 string reference to 'og_subgroups_handler_argument_gid'
- og_subgroups_views_arguments in ./
og_subgroups.views.inc - Implementation of hook_views_tables().
File
- ./
og_subgroups.views.inc, line 21
Code
function og_subgroups_handler_argument_gid($op, &$query, $argtype, $arg = '') {
switch ($op) {
case 'summary':
$query
->ensure_table('og_subgroups', true);
$query
->add_field('gid', 'og_subgroups');
$query
->add_where('og_subgroups.gid IS NOT NULL');
$fieldinfo['field'] = "og_subgroups.gid";
return $fieldinfo;
break;
case 'sort':
$query
->add_orderby('og_subgroups', 'gid', $argtype);
break;
case 'filter':
$joininfo = array(
'type' => 'LEFT',
'left' => array(
'table' => 'node',
'field' => 'nid',
),
'right' => array(
'field' => 'gid',
),
);
$num = $query
->add_table('og_subgroups', FALSE, 1, $joininfo);
$tablename = $query
->get_table_name('og_subgroups', $num);
$query
->add_field('gid', $tablename);
$query
->add_where('parent = %d', $arg);
break;
case 'link':
return l($query->title, "{$arg}/" . intval($query->gid));
case 'title':
return db_result(db_query_range('SELECT title FROM {node} WHERE nid = %d', $query, 0, 1));
}
}