'SimpleMenu', 'description' => 'Select the menu to display.', 'page callback' => 'drupal_get_form', 'page arguments' => array('simplemenu_admin_settings'), 'access arguments' => array('administer simplemenu'), 'file' => 'simplemenu.admin.inc', ); return $items; } /** * Is simplemenu enabled for this page request? */ function simplemenu_enabled() { static $enabled; if (!isset($enabled)) { global $theme; $exclusions = variable_get('simplemenu_exclusions', array()); $enabled = (user_access('view simplemenu') && (!isset($exclusions[$theme]) || !$exclusions[$theme]) && _simplemenu_page_visibility() && _simplemenu_superuser_active()); } return $enabled; } /** * Implementation of hook_init(). */ function simplemenu_init() { // do a simple access check here, since theme isn't available to check yet if (user_access('view simplemenu') && simplemenu_enabled()) { $path = drupal_get_path('module', 'simplemenu'); drupal_add_css($path .'/simplemenu.css'); $simplemenu_theme = variable_get('simplemenu_theme', 'original'); $theme_file = $path .'/themes/'. $simplemenu_theme .'/'. $simplemenu_theme .'.css'; if (is_file($theme_file)) { drupal_add_css($theme_file); } $settings = array( 'effect' => variable_get('simplemenu_effect', 'opacity'), 'effectSpeed' => variable_get('simplemenu_effect_speed', 'fast'), 'element' => variable_get('simplemenu_element', 'body'), 'hideDelay' => variable_get('simplemenu_hide_delay', 800), 'placement' => variable_get('simplemenu_element_method', 'prepend'), 'detectPopup' => variable_get('simplemenu_detect_popop', 1), ); drupal_add_js(array('simplemenu' => $settings), 'setting'); drupal_add_js($path .'/simplemenu.js'); drupal_add_js($path .'/superfish.js'); } } /** * Implementation of hook_footer(). * * This has been broken off of simplemenu_init() because simplemenu_get_menu() * calls simplemenu_menu_tree() which calls menu_tree_output() which has several * calls to theme(). This initializes the theme system too early causing hard * to track bugs. * * @see http://drupal.org/node/219910 */ function simplemenu_footer() { if (simplemenu_enabled()) { $simplemenu = drupal_to_js(simplemenu_get_menu()); $path = base_path() . drupal_get_path('module', 'simplemenu'); $output = "\n"; return $output; } } /** * Implementation of hook_perm(). */ function simplemenu_perm() { return array('view simplemenu', 'administer simplemenu'); } /** * Render an HTML list of links for a given menu. */ function simplemenu_get_menu() { $output = ''; // if a user turned off menu module but SimpleMenu was previously set // reset variable so a menu appears $menu_name = module_exists('menu') ? variable_get('simplemenu_menu', 'navigation:0') : 'navigation:0'; $menu = simplemenu_menu_tree($menu_name); if (!$menu) { $menu = '
  • '. t('No menu items found. Try a different menu as the default.') .'
  • '; } // This is ugly, I know, but it is the only way I can see to get the additional // links inside the