A module to have a css/javascript based drop down and javascript based pop-up menu for site navigation.
', array('!link' => l('admin/build/block', 'admin/build/block'))); break; } return $output; } /* * Settings form as implemented by hook_menu */ function yuimenu_admin_settings() { $form['yuimenu_root'] = array( '#type' => 'select', '#title' => t('Root of Menu Tree'), '#description' => t('Select the root item of menu tree.'), '#default_value' => variable_get('yuimenu_root','1'), '#options' => menu_parent_options(0), ); $form['yuimenu_type'] = array( '#type' => 'select', '#title' => t('Menu Display type'), '#description' => t('Select the display type of the menu.'), '#default_value' => variable_get('yuimenu_type','tna'), '#options' => array('tns' =>'Website Top Nav With Submenus From JavaScript', 'tnm' =>'Website Top Nav With Submenus Built From Markup', 'lns' =>'Website Left Nav With Submenus From JavaScript') ); $form['yuimenu_animate'] = array( '#type' => 'checkbox', '#title' => t('Animated Menu'), '#description' => t('To enable animation while opening menu check this.'), '#default_value' => variable_get('yuimenu_animate',0), ); return system_settings_form($form); } /** * Implemention of hook_menu(). */ function yuimenu_menu($may_cache) { if (!$may_cache) { $yui_source = variable_get('yui_source','http://yui.yahooapis.com/2.3.0'); // the order of script and style sheet is important. Don't change. yui_add_js('menu', $yui_source, '/build/yahoo-dom-event/yahoo-dom-event.js'); if (variable_get('yuimenu_animate',0)) { yui_add_js('menu', $yui_source, '/build/animation/animation-min.js'); } yui_add_css('menu', $yui_source, '/build/menu/assets/skins/sam/menu.css'); yui_add_js('menu', $yui_source, '/build/container/container_core-min.js'); yui_add_js('menu', $yui_source, '/build/menu/menu-min.js'); switch (variable_get('yuimenu_type','tns')) { case 'tns': $script_body_to_html_head = get_yui_top_script(); break; case 'tnm': $script_body_to_html_head = get_yui_top_markup(); break; case 'lns': $script_body_to_html_head = get_yui_left_script(); break; } drupal_set_html_head($script_body_to_html_head); drupal_add_css(drupal_get_path('module', 'yuimenu') .'/yuimenu.css'); } else { $items[] = array( 'path' => 'admin/settings/yuimenu', 'title' => t('YUI Menu Settings'), 'callback' => 'drupal_get_form', 'callback arguments' => 'yuimenu_admin_settings', 'access' => user_access('access administration pages'), 'type' => MENU_NORMAL_ITEM, ); } return $items; } function get_yui_top_markup () { $scr = ' '; return ($scr); } function get_yui_top_script () { $scr = ''; return ($scr); } /* * when menu has a " or ' the script is fails. So replace them. */ function rep_char ($inStr) { $fromChar= array("\"","\\"); $toChar = array("'","-"); $outStr = str_replace($fromChar, $toChar, $inStr); return ($outStr); //return t($inStr); } function html_menu($pid = 1) { switch (variable_get('yuimenu_type','tns')) { case 'tns' : $output = get_html_menu_script($pid); break; case 'lns' : $output = get_html_menu_script($pid); break; case 'tnm' : $output = get_html_menu_markup($pid); break; } return $output; } function get_html_menu_script ($pid) { $menu = menu_get_menu(); $output .='