-
-
Save msankhala/f06ef3382434bc404f64 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Theme_menu_tree doesn't provide any context information | |
* THIS SUCKS | |
* But you can use hook_block_view_alter to change the theme wrapper | |
* OUF! | |
*/ | |
function MYTHEME_menu_tree(&$variables) { | |
return '<ul class="nav">' . $variables['tree'] . '</ul>'; | |
} | |
function MYTHEME_menu_tree__menu_top_menu(&$variables) { | |
return '<ul class="nav center">' . $variables['tree'] . '</ul>'; | |
} | |
//main menu (top) using the menu block module | |
function MYTHEME_menu_tree__menu_block__2(&$variables) { | |
return '<ul class="nav main-nav nav-horizontal">' . $variables['tree'] . '</ul>'; | |
} | |
//main menu (level 2 sidebar) using the menu block module | |
function MYTHEME_menu_tree__menu_block__1(&$variables) { | |
return '<ul>' . $variables['tree'] . '</ul>'; | |
} | |
function MYTHEME_menu_tree__menu_block__1__level1(&$variables) { | |
return '<ul class="nav nav-list">' . $variables['tree'] . '</ul>'; | |
} | |
/** | |
* Implements hook_block_view_alter(). | |
*/ | |
function MYTHEME_block_view_alter(&$data, $block) { | |
// Check we get the right menu block (side bar) | |
if ($block->bid == 'menu_block-1') { | |
// change the theme wrapper for the first level | |
$data['content']['#content']['#theme_wrappers'] = array('menu_tree__menu_block__1__level1'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment