function _views_build_summary in Views (for Drupal 7) 5
1 call to _views_build_summary()
File
- ./
views_query.inc, line 256
Code
function _views_build_summary(&$query, $argtype, $option, $self_sort) {
$arginfo = _views_get_arguments();
if (!function_exists($arginfo[$argtype]['handler'])) {
return false;
}
$primary_field = $query->fields[0];
$query
->clear_fields();
$fieldinfo = $arginfo[$argtype]['handler']('summary', $query, $argtype, $option);
if ($fieldinfo['fieldname']) {
$query
->add_field($fieldinfo[field], '', $fieldinfo[fieldname]);
}
$query
->add_field("count({$primary_field})", '', 'num_nodes');
$query
->add_groupby($fieldinfo['field']);
$query
->set_count_field("DISTINCT({$fieldinfo['field']})");
if ($self_sort) {
$arginfo[$argtype]['handler']('sort', $query, $self_sort);
}
$query->no_distinct = TRUE;
// prevent DISTINCT from mucking up summaries.
}