function recipe_category_index_page in Recipe 6
@file recipe_category_index.inc - This is an include file containing most all of the recipe category index page functionality.
1 string reference to 'recipe_category_index_page'
- recipe_menu in ./
recipe.module - Implementation of hook_menu().
File
- ./
recipe_category_index.inc, line 8 - recipe_category_index.inc - This is an include file containing most all of the recipe category index page functionality.
Code
function recipe_category_index_page() {
drupal_add_css(drupal_get_path('module', 'recipe') . '/recipe_category_index.css', 'module');
// You are viewing a term
$tree = array(
'current_term' => FALSE,
'term_tree' => array(),
'node_list' => FALSE,
'recent_list' => FALSE,
);
$term = NULL;
if ($tid = intval(arg(2))) {
$term = taxonomy_get_term($tid);
$vocabs = taxonomy_get_vocabularies('recipe');
if (isset($vocabs[$term->vid])) {
$tree['current_term'] = $term;
$tree['term_tree'][] = taxonomy_get_tree($term->vid, $tid, -1, variable_get('recipe_index_depth', 4));
}
}
else {
if ($vocabs = taxonomy_get_vocabularies('recipe')) {
foreach ($vocabs as $vocab) {
$tree['term_tree'][] = taxonomy_get_tree($vocab->vid, 0, -1, variable_get('recipe_index_depth', 4));
}
}
}
// You are on the top level, don't display every recipe.
if ($term == NULL) {
// Nothing right now.
}
else {
if (variable_get('recipe_index_catalog_show_child_category_links', 1) == 0) {
$tree['node_list'] = recipe_get_nodes_for_terms(array(
$term->tid,
));
}
else {
$term_list = array(
$term->tid,
);
foreach ($tree['term_tree'] as $vocab) {
foreach ($vocab as $t) {
$term_list[] = $t->tid;
}
}
$tree['node_list'] = recipe_get_nodes_for_terms($term_list);
}
}
return theme('recipe_category_index_page', $tree);
}