Return to Snippet

Revision: 25944
at April 14, 2010 11:42 by electblake


Initial Code
/**
 * Implementation of hook_nodeapi().
 *
 * This will evaluate individual nodes when being viewed and take the necessary
 * steps to set the active_trail for menus.
 *
 * This will retain menu state at the node/view level. For instance, forum nodes
 * would maintain an active trail to the forum menu item.
 */
function hook_nodeapi(&$node, $op, $a3 = NULL, $page = FALSE) {
  if ($op == 'view' && $page == TRUE && $node->type == 'your-type') {

		// IF YOU HAVE ALIAS AND NOT INTERNAL PATH
		/// $path = drupal_lookup_path('source',$url);
  	$item = menu_get_item('internal-drupal-path');
    if ($item) {
      menu_set_item(null, $item);
    }
  }
}

Initial URL


Initial Description
initial code and concept bitten from: http://drupal.org/project/menutrails

Initial Title
How to manually set active menu for nodes

Initial Tags
path, drupal

Initial Language
PHP