From 163cca42f0d572f080ba7d31407053587f60f0f0 Mon Sep 17 00:00:00 2001 From: Silvio Date: Fri, 16 Oct 2009 11:03:22 -0300 Subject: First version with working functions --- taxonomy_node_tree.module | 202 +++++++++++++++++++++++++++++++++------------- 1 file changed, 148 insertions(+), 54 deletions(-) diff --git a/taxonomy_node_tree.module b/taxonomy_node_tree.module index 40d71dc..088c02a 100644 --- a/taxonomy_node_tree.module +++ b/taxonomy_node_tree.module @@ -2,12 +2,14 @@ // $Id$ /** - * Drawer logic. + * Return the parent terms of a given vocabulary. + * + * This function takes a vocabulary id and returns a + * list of it's parent terms. */ -function theme_taxonomy_node_tree($menu_name, $mlid) { +function taxonomy_node_tree_parents($vid) { // Get all terms from a given vocabulary - $vocabulary = variable_get('taxonomy_node_tree', '1'); - $terms = taxonomy_node_tree_taxonomy_get_tree($vocabulary); + $terms = taxonomy_node_tree_taxonomy_get_tree($vid); foreach ($terms as $term) { // Just show parent terms @@ -16,24 +18,45 @@ function theme_taxonomy_node_tree($menu_name, $mlid) { } } - // Build the drawer - $output = taxonomy_node_tree_build($menu); - return $output; + return $menu; +} + +/** + * Implementation of hook_theme(); + * + * @TODO: update + */ +function taxonomy_node_tree_theme() { + return array( + 'taxonomy_node_tree_menu_parents' => array( + 'arguments' => array( + 'menu' => NULL, + 'parent' => NULL, + ), + ), + 'taxonomy_node_tree_link' => array( + 'arguments' => array(), + ), + ); } /** - * Drawer rendering. + * Render the parent items of a menu. * * @ingroup themeable */ -function taxonomy_node_tree_build($menu) { +function theme_taxonomy_node_tree_menu_parents($menu, $class = 'menu', $id = NULL, $base = NULL) { + + if ($id != NULL) { + $id = ' id="'. $id .'"'; + } - $output = '