Establishing context for menus in nodes

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']); } }

Related Posts

Mega Menus Done Right

Kayla Wren
Read more

Introduction to Drupal nodes

Tom McCracken
Read more

Drupal Mega Menus Made Simple

Mark Carver
Read more

If you aren't using Entity API to create nodes, you are doing it wrong

Randall Knutson
Read more

Drupal Importing Nodes with the Feeds Module

Chris Sloan
Read more

Improving Menu Views in Drupal 7 to Create Mega Menus More Efficiently

Mark Carver
Read more