aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--taxonomy_node_tree.module51
1 files changed, 48 insertions, 3 deletions
diff --git a/taxonomy_node_tree.module b/taxonomy_node_tree.module
index 9288de4..07ea515 100644
--- a/taxonomy_node_tree.module
+++ b/taxonomy_node_tree.module
@@ -42,6 +42,7 @@ function taxonomy_node_tree_parents($vid) {
*
* @param $nodes
* Array with node objects.
+ *
* @param $terms
* Array with term objects.
*
@@ -93,6 +94,7 @@ function taxonomy_node_tree_relation($tree) {
*
* @param $tree
* Tree with term objects to be changed (by reference).
+ *
* @param $term
* Term object.
*/
@@ -136,6 +138,7 @@ function taxonomy_node_tree_hierarchy($tree) {
*
* @param $nodes
* Array with node objects.
+ *
* @param $terms
* Array with term objects.
*
@@ -156,13 +159,17 @@ function taxonomy_node_tree_build($nodes, $terms) {
*
* @param $vid
* Which vocabulary to generate the tree for.
+ *
* @param $parent
* The term ID under which to generate the tree. If 0, generate the tree
* for the entire vocabulary.
+ *
* @param $depth
* Internal use only.
+ *
* @param $max_depth
* The number of levels of the tree to return. Leave NULL to return all levels.
+ *
* @param $cache
* Whether to use cache results.
*
@@ -209,12 +216,47 @@ function taxonomy_node_tree_taxonomy_get_tree($vid, $parent = 0, $depth = -1, $m
}
/**
+ * Implementation of hook_theme().
+ */
+function taxonomy_node_tree_theme() {
+ return array(
+ 'taxonomy_node_tree_list' => array(
+ 'arguments' => array(
+ 'term' => NULL,
+ 'id' => NULL,
+ 'class' => NULL,
+ 'baselink' => NULL,
+ 'level' => NULL,
+ ),
+ 'function' => 'theme_taxonomy_node_tree_list',
+ ),
+ );
+}
+
+/**
* Recursively build an HTML taxonomy node tree.
*
* @ingroup themeable
- * @todo Usage with hook_theme().
+ *
+ * @param $term
+ * Current of starting term.
+ *
+ * @param $id
+ * Base id for list elements.
+ *
+ * @param $class
+ * Class for list elements.
+ *
+ * @param $baselink
+ * Base link for urls.
+ *
+ * @param $level
+ * Nesting level user for recursion.
+ *
+ * @return
+ * Rendered HTML tree.
*/
-function taxonomy_node_tree_list($term, $id, $class, $baselink = NULL, &$level = NULL) {
+function theme_taxonomy_node_tree_list($term, $id, $class, $baselink = NULL, &$level = NULL) {
if ($level == NULL) {
$level = 0;
@@ -229,7 +271,7 @@ function taxonomy_node_tree_list($term, $id, $class, $baselink = NULL, &$level =
$output .= $term->name;
$output .= '<ul id="' . $id .'-ul-'. $level .'" class="'. $class .'">';
foreach ($term->below as $child) {
- $output .= taxonomy_node_tree_list($child, $id, $class, $baselink, $level);
+ $output .= theme_taxonomy_node_tree_list($child, $id, $class, $baselink, $level);
}
$output .= '</ul>';
}
@@ -258,6 +300,9 @@ function taxonomy_node_tree_list($term, $id, $class, $baselink = NULL, &$level =
*
* @param $parents
* Direct or all parent terms.
+ *
+ * @return
+ * Array with node and parent terms.
*/
function taxonomy_node_tree_trail($nid, $tid, $parents = 'direct') {
$trail = array();