function theme_taxonomy_menu_block in Taxonomy menu block 7
Generate markup for our list.
1 theme call to theme_taxonomy_menu_block()
- taxonomy_menu_block_build in ./
taxonomy_menu_block.module - Function to build our tree.
File
- ./
taxonomy_menu_block.module, line 802 - Taxonomy Menu Block module allows you to make menu blocks out of your taxonomies in a very performant way.
Code
function theme_taxonomy_menu_block($variables) {
$tree = $variables['items'];
$config = $variables['config'];
$num_items = count($tree);
$i = 0;
$output = '<ul>';
foreach ($tree as $tid => $term) {
$i++;
// Add classes.
$attributes = array();
if ($i == 1) {
$attributes['class'][] = 'first';
}
if ($i == $num_items) {
$attributes['class'][] = 'last';
}
if ($term['active_trail'] == '1') {
$attributes['class'][] = 'active-trail';
}
if ($term['active_trail'] == '2') {
$attributes['class'][] = 'active';
}
if (!empty($term['children'])) {
$attributes['class'][] = 'has-children';
}
// Alter link text if we have to display the nodes attached.
if (isset($term['nodes'])) {
$term['name'] = $term['name'] . ' (' . $term['nodes'] . ')';
}
$output .= '<li' . drupal_attributes($attributes) . '>' . l($term['name'], $term['path'], $term['link_options']);
if (!empty($term['children'])) {
$output .= theme('taxonomy_menu_block__' . $config['delta'], array(
'items' => $term['children'],
'config' => $config,
));
}
$output .= '</li>';
}
$output .= '</ul>';
return $output;
}