function theme_recipe_category_index_page in Recipe 6
1 theme call to theme_recipe_category_index_page()
- recipe_category_index_page in ./
recipe_category_index.inc - @file recipe_category_index.inc - This is an include file containing most all of the recipe category index page functionality.
File
- ./
recipe_category_index.inc, line 55 - recipe_category_index.inc - This is an include file containing most all of the recipe category index page functionality.
Code
function theme_recipe_category_index_page($tree = NULL) {
// Render the term tree first.
$output = '<div class="recipe_index_category_list">';
$output1 = '';
foreach ($tree['term_tree'] as $vocab) {
$output1 .= '<ul class="recipe_index_category_parents">';
$depth = -1;
foreach ($vocab as $term) {
// You are just starting.
if ($depth == -1) {
// Do nothing but prevent further checks
}
elseif ($term->depth == $depth) {
$output1 .= '</li>';
}
elseif ($term->depth > $depth) {
$output1 .= '<ul class="recipe_index_category_children">';
}
// Go up some levels.
while ($term->depth < $depth) {
$output1 .= '</li></ul>';
$depth--;
}
$output1 .= '<li>' . l($term->name, 'recipe/bycat/' . $term->tid);
$depth = $term->depth;
}
// Clean up if you ended at a lower level.
while ($depth > 0) {
$output1 .= '</li></ul>';
$depth--;
}
$output1 .= '</li></ul>';
}
if ($tree['current_term']) {
$output .= theme('box', t('Categories: %term_name', array(
'%term_name' => $tree['current_term']->name,
)), $output1);
}
else {
$output .= theme('box', t('Categories'), $output1);
}
$output .= '</div>';
// Set-up the right column.
$output .= '<div class="recipe_index_node_lists">';
// Render the node_list.
if ($tree['node_list']) {
$list = node_title_list($tree['node_list']);
if (strlen($list) > 0) {
$output .= theme('box', t('Matching recipes'), $list);
}
else {
$output .= theme('box', t('No matching recipes'));
}
}
$output .= "</div>";
// Set-up the breadcrumb tail.
if ($tree['current_term']) {
drupal_set_title(t('%term', array(
'%term' => $tree['current_term']->name,
)));
// Make the breadcrumbs pretty.
$breadcrumb = array();
$breadcrumb[] = l(t('Home'), NULL);
$breadcrumb[] = l(t('Recipes'), 'recipe');
$breadcrumb[] = l(t('By category'), 'recipe/bycat');
if ($parents = taxonomy_get_parents_all($tree['current_term']->tid)) {
// You don't want the current term to show up in the breadcrumbs.
array_shift($parents);
$parents = array_reverse($parents);
foreach ($parents as $p) {
$breadcrumb[] = l($p->name, 'recipe/bycat/' . $p->tid);
}
}
drupal_set_breadcrumb($breadcrumb);
}
drupal_set_title(t('Find by'));
return $output;
}