You are here

function theme_taxonomy_list_directory in Taxonomy List 5.2

Same name and namespace in other branches
  1. 6.2 taxonomy_list.module \theme_taxonomy_list_directory()
  2. 7 taxonomy_list.module \theme_taxonomy_list_directory()

Theme a directory list.

Parameters

$terms: the enhanced term tree.

$cells_per_row: the number of cells per row to display. -- not used for directory.

$list_mode: indicates how to show the hierarchy.

Return value

the themed list to be displayed.

File

./taxonomy_list.module, line 483
List all terms in a vocabulary.

Code

function theme_taxonomy_list_directory($terms, $cells_per_row = 1, $list_mode = 0) {
  $output = '<div class="taxonomy-list-directory">';
  foreach ($terms as $tid => $term) {
    if (!$term->depth) {

      // Only do top level terms here.
      $data = $term->image . $term->title . $term->desc;
      $nodes = taxonomy_list_select_nodes(array(
        $tid,
      ));
      $no_nodes = TRUE;
      while ($nid = db_result($nodes)) {
        $node = node_load($nid);
        node_view($node, TRUE, FALSE, FALSE);
        $data .= theme('taxonomy_list_directory_node', $node, $term);
        $no_nodes = FALSE;
      }

      // If there were no nodes, skip the whole thing.
      if ($no_nodes) {
        continue;
      }
      if ($term->children) {
        $data .= _taxonomy_list_directory_children($term->children, $terms);
      }
      $fieldset = array(
        '#title' => check_plain($term->name),
        '#collapsible' => TRUE,
        '#collapsed' => TRUE,
        '#value' => $data,
      );
      $output .= theme('fieldset', $fieldset);
    }
  }
  return $output . '</div>';
}