function menu_minipanels_theme_registry_alter in Menu Minipanels 7
Same name and namespace in other branches
- 6 menu_minipanels.module \menu_minipanels_theme_registry_alter()
- 7.2 menu_minipanels.module \menu_minipanels_theme_registry_alter()
Implements hook_theme_registry_alter().
Theme preprocess functions aren't called if the theme is in a function.
This hacks a preprocess function for theme_menu_link in a way that won't interfere with other themes or modules that override theme_menu_link.
theme_menu_link is overriddeden because to print menus, themes and modules generally use menu_tree_output, and menu_tree_output calls theme_menu_link.
This method *only* works if theme_menu_link is called *before* $closure is created in page_preprocess.
If a theme calls theme('menu_tree') in a page.tpl.php for instance, this will not work.
To get it to work, the theme will need to implement page_preprocess hook and add a variable to $vars, so that the theme_menu_link is called *before* $closure.
File
- ./
menu_minipanels.module, line 271 - Allows an administrator to specify a minipanel to be associated with a Drupal menu item. When that menu item is hovered or clicked (as per config), the minipanel content will be shown using the qTip javascript library.
Code
function menu_minipanels_theme_registry_alter(&$vars) {
// Copy the original `link` theme function into our namespace, then override
// the original function with our version. The original will be invoked by
// our version.
$vars['menu_minipanels_theme_link_default'] = $vars['link'];
$vars['link']['function'] = 'menu_minipanels_theme_link';
}