function theme_views_bonus_panels_byterm_summary in Views Bonus Pack 5
File
- ./
views_bonus_panels.module, line 187
Code
function theme_views_bonus_panels_byterm_summary($view) {
drupal_add_css(drupal_get_path('module', 'views_bonus_panels_threecol_term') . '/views_bonus.css');
// Argument 0 must be a vocabulary ID
$vid = $view->args[0];
$tree = taxonomy_get_tree($vid);
// group terms with their parent
foreach ($tree as $term) {
$cnt = taxonomy_term_count_nodes($term->tid);
if ($term->depth > 1) {
$prefix = $prefix = str_repeat('--', $term->depth - 1) . ' ';
}
$txt = array(
$prefix . l($term->name, "{$view->real_url}/{$term->tid}") . " ({$cnt})",
);
if ($term->depth == 0) {
$parent_tid = $term->tid;
$groups[$parent_tid]['header'] = $txt;
}
else {
$groups[$parent_tid]['rows'][] = $txt;
}
}
// Render the groups into tables spread across 3 columns
$content = array();
foreach ($groups as $group) {
$content[] = theme('table', $group['header'], $group['rows']);
}
return panels_print_layout('threecol_33_34_33', $content);
}