Establishing context for menus in nodes
//establish context
switch ($node->type) {
case 'product':
$path = 'products';
break;
//.....
default:
$path = false;
break;
}
if ($path) {
menu_set_active_trail(menu_get_item($path));
$tree = menu_tree_all_data('primary-links');
} else {
$tree = menu_tree_page_data('primary-links');
}
foreach($tree as $key => $mi) {
if ($mi['link']['in_active_trail'] || $path == $mi['link']['link_path']) {
$menu = menu_tree_output($tree[$key]['below']);
}
}