? taxonomyblocks.highlight.patch
Index: taxonomyblocks.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/taxonomyblocks/taxonomyblocks.module,v
retrieving revision 1.9
diff -u -p -r1.9 taxonomyblocks.module
--- taxonomyblocks.module	31 Jan 2009 21:12:45 -0000	1.9
+++ taxonomyblocks.module	1 Feb 2009 13:37:32 -0000
@@ -766,9 +766,50 @@ function taxonomy_recursive_array_builde
     }
      
   }
+   
+  //start patch 1
+  //if node is shown, add attribute to tids that are linked to the node
+  taxonomyblocks_highlight_active_terms($tree);
+  //end patch 1
  
   return $tree;
 }
+
+//start patch 2
+function taxonomyblocks_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
+  switch ($op) {
+    case 'view':
+      _taxonomyblocks_node_terms('set', $node);
+      break;
+  }
+}
+
+function _taxonomyblocks_node_terms($action = 'get', $node = NULL ) {
+  static $terms = array();
+  
+  switch ($action) {
+    case 'get':
+      return $terms;
+    case 'set':
+      $node_terms = isset($node->taxonomy) ? array_keys($node->taxonomy) : array();
+      $terms = array_merge($terms, $node_terms);
+      break;
+  }
+}
+
+function taxonomyblocks_highlight_active_terms(&$tree) {
+  $terms = _taxonomyblocks_node_terms();
+  if (count($terms)) {
+    foreach ( $tree as $key => $values ) {
+      $tid = $values['link']['tid'];
+      if (in_array($tid, $terms)) {
+        $tree[$key]['link']['options']['attributes']['class'] = 'active_term';
+      }
+    }
+  }
+}
+//end patch 2
+
 function jq_taxonomy_tree_creator($vid, $pathpattern = NULL, $nodecounter = 'all', $titlepattern = NULL, $omit = NULL) {
   $tree = array();
   $toplevel = taxonomy_get_toplevel($vid);
@@ -806,4 +847,4 @@ function taxonomyblocks_help($path, $arg
     case 'admin/settings/taxonomyblocks/configure' :
       return t('These settings will only affect the display of vocabs in this particular block. Please note that while the path pattern gives you control over the href of the links, it is up to you to insure that there is a view or a menu callback in place to catch them. Also note that while the node count options allow you to specify which content types will be counted up this does not mean that the page will be automatically adjusted to only show this content type. You must control this from within the view that you create. If you don\'t know what any of this means, then you should probably just leave the defaults in place for the path pattern. By default blocks containing multiple taxonomies will have either the title of the vocab or the custom title of your choosing. If you wish to display multiple vocabs with no titles over individual vocabs you can enter &lt;none&gt; for the custom title field.');
   }
-}
\ No newline at end of file
+}
