You are here

function theme_taxonomy_list_list in Taxonomy List 7

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

Theme a list of the term tree.

Parameters

$terms: the enhanced term tree.

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

$list_mode: indicates how to show the hierarchy.

Return value

the themed list to be displayed.

File

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

Code

function theme_taxonomy_list_list($variables) {
  $terms = $variables['terms'];
  $cells_per_row = $variables['cells'];
  $list_mode = $variables['title'];
  $items = array();
  $odd_even = array(
    'even',
    'odd',
  );
  $i = 0;
  foreach ($terms as $tid => $term) {
    ++$i;
    switch ($list_mode) {
      case 0:

        // Hierarchical.
        if ($term->depth) {
          continue;
        }
        $variables = array(
          'term' => $term,
        );
        $item = array(
          'data' => theme('taxonomy_list_term', $variables),
          'class' => array(
            $odd_even[$i & 1],
          ),
        );
        if ($term->children) {
          $item['children'] = _taxonomy_list_list_children($term->children, $terms);
        }
        $items[] = $item;
        break;
      case 1:

        // Flat.
        $items[] = array(
          'data' => theme('taxonomy_list_term', $variables),
          'class' => array(
            $odd_even[$i & 1],
          ),
        );
        break;
    }
  }
  return theme('item_list', array(
    'items' => $items,
    'type' => 'ul',
    'attributes' => array(
      'class' => array(
        'taxonomy-list-list',
      ),
    ),
  ));
}