function menu_minipanels_theme_link in Menu Minipanels 7.2
Same name and namespace in other branches
- 7 menu_minipanels.module \menu_minipanels_theme_link()
Replacement theme function for theme_link().
Injects menu minipanels into to links without disturbing themes that may also implement the theme_link() function.
See also
menu_minipanels_theme_registry_alter()
1 string reference to 'menu_minipanels_theme_link'
- menu_minipanels_theme_registry_alter in ./
menu_minipanels.module - Implements hook_theme_registry_alter().
File
- ./
menu_minipanels.module, line 223 - Menu MiniPanels provides a flexible "mega menu" solution for Drupal by allowing a minipanel to be associated with a Drupal menu item. When that menu item is hovered, the minipanel content will be shown using standard CSS :hover techniques…
Code
function menu_minipanels_theme_link($link) {
$minipanel = '';
if (!empty($link['options']['minipanel'])) {
$prefix = '';
if (empty($link['options']['attributes'])) {
$link['options']['attributes'] = array();
}
if (empty($link['options']['attributes']['class'])) {
$link['options']['attributes']['class'] = array();
}
$link['options']['attributes']['class'][] = 'menu-minipanel';
$link['options']['attributes']['class'][] = 'menu-minipanel-' . $link['options']['menu_minipanels_hover']['mlid'];
// Superfish and Nice Menus functionality depend on a menuparent class.
if (!in_array('menuparent', $link['options']['attributes']['class'])) {
$link['options']['attributes']['class'][] = 'menuparent';
}
// Render the mini panel.
if (!menu_minipanels_excluded_path()) {
$minipanel = theme('menu_minipanel', array(
'minipanel_name' => $link['options']['minipanel'],
'mlid' => $link['options']['menu_minipanels_hover']['mlid'],
));
}
}
// Render the link via our internally stored reference to the original
// theme_link function, and then append the minipanel, if it exists.
return theme('menu_minipanels_theme_link_default', $link) . $minipanel;
}