Index: menutrails.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/menutrails/menutrails.module,v retrieving revision 1.2.2.1 diff -u -r1.2.2.1 menutrails.module --- menutrails.module 27 Jun 2007 23:09:56 -0000 1.2.2.1 +++ menutrails.module 19 Sep 2007 11:57:00 -0000 @@ -48,12 +48,26 @@ $item = menu_get_item(NULL, 'node/'.$node->nid); // type = 4 is for a callback if ($item['type'] == 4) { - $type_trails = variable_get('menutrails_node_types', array()); - $mid = $type_trails[$node->type]; - $term_trails = variable_get('menutrails_terms', array()); - foreach($node->taxonomy as $tid => $term) { - if ($term_trails[$tid] > 0) { - $mid = $term_trails[$tid]; + if ( $path = module_invoke_all('menutrails_trail',$node) ) { + if (is_numeric($path[0])) { + //Is a menu ID + watchdog("two or more modules are trying to set the active menu path of this item!"); + $mid = $mid($path[0]); + } else { + //this is a path + global $_menu; + $mid = $_menu['path index'][$path[0]]; + } + } else { + + $type_trails = variable_get('menutrails_node_types', array()); + $mid = $type_trails[$node->type]; + $term_trails = variable_get('menutrails_terms', array()); + + foreach($node->taxonomy as $tid => $term) { + if ($term_trails[$tid] > 0) { + $mid = $term_trails[$tid]; + } } } if ($mid > 0) { @@ -64,7 +78,7 @@ } $location = array_reverse($location); $location[] = array('path' => 'node/'.$node->nid, 'title' => $node->title); - } + } return $location; } } @@ -263,4 +277,17 @@ } $link['mid'] = $mid; return $link; -} \ No newline at end of file +} +/** + * Is fired when a node is being shown in page view. + * You can use this function to return either + * a path you want to be the node's parent + * OR + * an mid you want to act as the node's parent + * + * @param object $node + * @return string|int + */ +function hook_menutrails_trail($node) { + +} \ No newline at end of file