function theme_taxonomy_list_table in Taxonomy List 5.2
Same name and namespace in other branches
- 6.2 taxonomy_list.module \theme_taxonomy_list_table()
- 7 taxonomy_list.module \theme_taxonomy_list_table()
Theme a table of the term tree.
Parameters
$terms: the enhanced term tree.
$cells_per_row: the number of cells per row to display.
$list_mode: indicates how to show the hierarchy.
Return value
the themed list to be displayed.
File
- ./
taxonomy_list.module, line 396 - List all terms in a vocabulary.
Code
function theme_taxonomy_list_table($terms, $cells_per_row = 1, $list_mode = 0) {
$rows = $cells = array();
$curr_col = -1;
$curr_depth = 0;
foreach ($terms as $tid => $term) {
if (!isset($vid)) {
// If recursive, watch out for this.
$vid = $term->vid;
}
$class = 'taxonomy-list-depth-' . $term->depth;
// List_mode = 0 is hierarchical; = 1 is flat.
if ($curr_depth != $term->depth && $list_mode == 0) {
$rows[] = $cells;
$cells = array();
$curr_col = -1;
$curr_depth = $term->depth;
}
if ($term->children) {
$class .= ' taxonomy-list-parent';
}
$cells[] = '<div class="' . $class . '">' . theme_taxonomy_list_term($term) . '</div>';
$curr_col = ($curr_col + 1) % $cells_per_row;
if ($curr_col == $cells_per_row - 1) {
$rows[] = $cells;
$cells = array();
}
}
if ($cells) {
$rows[] = $cells;
}
return theme('table', array(), $rows, array(
'id' => 'taxonomy-list-table-' . $vid,
));
}