' . t('DHTML Menu adds dynamic functionality to the menus of your site. Ordinarily, reaching the child elements below an item requires you to visit its page. With this module enabled, clicking on an item with child elements will expand it without leaving the page, saving you the time of waiting for the page to load.') . '

'; $text .= '

' . t('Note: Links that gain a dynamic Javascript effect naturally stop working as normal links. Since you will occasionally need to visit a page that has sub-items (like the main administration page), this module provides several different options for static and dynamic navigation to coexist.', array('@url' => url('admin'))) . '

'; return $text; } } /** * Implementation of hook_init(). * Adds CSS, Javascript and settings to the page. */ function dhtml_menu_init() { drupal_add_css(drupal_get_path('module', 'dhtml_menu') . '/dhtml_menu.css'); drupal_add_js(drupal_get_path('module', 'dhtml_menu') . '/dhtml_menu.js'); drupal_add_js(array('dhtmlMenu' => variable_get('dhtml_menu_settings', array())), 'setting'); } /** * Implementation of hook_menu(). * Adds a settings page. */ function dhtml_menu_menu() { $menu['admin/settings/dhtml_menu'] = array( 'title' => 'DHTML Menu', 'description' => 'Configure the behavior of DHTML Menu.', 'page callback' => 'drupal_get_form', 'page arguments' => array('dhtml_menu_settings'), 'access arguments' => array('administer site configuration'), 'file' => 'dhtml_menu.admin.inc', ); return $menu; } /** * Implementation of hook_theme_registry_alter(). * Replaces the theme functions for the menu_item functions, and stores the * original functions in order to call them when this module is done with preprocessing. */ function dhtml_menu_theme_registry_alter(&$theme_registry) { global $theme; // Back up the existing theme functions. $themes = variable_get('dhtml_menu_theme', array()); $themes[$theme] = array( 'menu_item' => $theme_registry['menu_item']['function'], 'menu_item_link' => $theme_registry['menu_item_link']['function'], ); variable_set('dhtml_menu_theme', $themes); // Replace them with our own. These will "preprocess" and call the real functions. $theme_registry['menu_item']['function'] = 'dhtml_menu_theme_menu_item'; $theme_registry['menu_item_link']['function'] = 'dhtml_menu_theme_menu_item_link'; }