function template_preprocess_views_view_summary
Preprocess theme function to print a single record from a row, with fields.
File
-
theme/
theme.inc, line 369
Code
function template_preprocess_views_view_summary(&$vars) {
$view = $vars['view'];
$argument = $view->argument[$view->build_info['summary_level']];
$vars['row_classes'] = array();
$url_options = array();
if (!empty($view->exposed_raw_input)) {
$url_options['query'] = $view->exposed_raw_input;
}
$active_urls = drupal_map_assoc(array(
// Force system path.
url($_GET['q'], array(
'alias' => TRUE,
)),
url($_GET['q'], $url_options + array(
'alias' => TRUE,
)),
// Could be an alias.
url($_GET['q']),
url($_GET['q'], $url_options),
));
// Collect all arguments foreach row, to be able to alter them for example by
// the validator. This is not done per single argument value, because this
// could cause performance problems.
$row_args = array();
foreach ($vars['rows'] as $id => $row) {
$row_args[$id] = $argument->summary_argument($row);
}
$argument->process_summary_arguments($row_args);
foreach ($vars['rows'] as $id => $row) {
$vars['row_classes'][$id] = '';
$vars['rows'][$id]->link = $argument->summary_name($row);
$args = $view->args;
$args[$argument->position] = $row_args[$id];
$base_path = NULL;
if (!empty($argument->options['summary_options']['base_path'])) {
$base_path = $argument->options['summary_options']['base_path'];
}
$vars['rows'][$id]->url = url($view->get_url($args, $base_path), $url_options);
$vars['rows'][$id]->count = intval($row->{$argument->count_alias});
if (isset($active_urls[$vars['rows'][$id]->url])) {
$vars['row_classes'][$id] = 'active';
}
}
}