Skip to content

Instantly share code, notes, and snippets.

@danreb
Created September 25, 2012 01:31
Show Gist options
  • Save danreb/3779462 to your computer and use it in GitHub Desktop.
Save danreb/3779462 to your computer and use it in GitHub Desktop.
Example code for overriding specific menu in Drupal 7 using theme_menu_tree()
<?php
/**
* Implements hook_menu_tree
* Wrap main menu with 2 division (Bootstrap)
*
*/
function speedy_menu_tree__main_menu($vars) {
return '<div class="navbar"><div class="navbar-inner"><ul class="nav">' . $vars['tree'] . '</ul></div></div>';
}
/**
* Implements hook_menu_tree
* Remove class for user menu
*
*/
function speedy_menu_tree__user_menu($vars) {
return '<ul>' . $vars['tree'] . '</ul>';
}
@danreb
Copy link
Author

danreb commented Sep 25, 2012

Please note, the word speedy in my function name is the name of my theme. Make sure to replace that with the correct name, this examples uses theme_menu_tree() function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment