--- nice_menus.module.ORIG 2008-11-30 08:20:21.000000000 -0600 +++ nice_menus.module 2008-12-01 13:30:57.000000000 -0600 @@ -63,10 +63,10 @@ function nice_menus_system_theme_setting */ function nice_menus_menu($may_cache) { if (!$may_cache) { - // Add JavaScript, if enabled. - if (variable_get('nice_menus_ie', 1) == 1) { - drupal_add_js(drupal_get_path('module', 'nice_menus') .'/nice_menus.js'); - } + // Add JavaScript, if enabled. + if (variable_get('nice_menus_ie', 1) == 1) { + drupal_add_js(drupal_get_path('module', 'nice_menus') .'/nice_menus.js'); + } // Add main CSS functionality. drupal_add_css(drupal_get_path('module', 'nice_menus') .'/nice_menus.css'); @@ -193,6 +193,46 @@ function nice_menus_block($op = 'list', } /** + * Returns the rendered link to a menu item. + * + * This is largely a copy of menu_item_link() + * http://api.drupal.org/api/function/menu_item_link/5 + * + * @param $mid + * The menu item id to render. + * @return + * An HTML string of a link as rendered by theme_nice_menu_item_link(). + */ +function nice_menus_item_link($mid) { + $item = menu_get_item($mid); + $link_item = $item; + $link = ''; + + while ($link_item['type'] & MENU_LINKS_TO_PARENT) { + $link_item = menu_get_item($link_item['pid']); + } + + return theme('nice_menu_item_link', $item, $link_item); +} + +/** + * Themes the link to a menu item. + * + * This is largely a copy of theme_menu_item_link() + * http://api.drupal.org/api/function/theme_menu_item_link/5 + * + * @param $item + * The menu item to render. + * @param $link_item + * The menu item which should be used to find the correct path. + * @return + * An HTML string of a link. + */ +function theme_nice_menu_item_link($item, $link_item) { + return l($item['title'], $link_item['path'], array(), isset($item['query']) ? $item['query'] : NULL); +} + +/** * Builds the inner portion of a nice menu. * * @param $pid @@ -219,7 +259,7 @@ function theme_nice_menu_tree($pid = 1, $clean_path = str_replace('/', '-', $clean_path); $path_class = 'menu-path-'. $clean_path; if (count($menu['visible'][$mid]['children']) > 0) { - $output['content'] .= '