From 03cc8469dc90f98412009cab79840da821a26919 Mon Sep 17 00:00:00 2001 From: Alexis Wilke Date: Sun, 16 May 2010 23:20:01 +0000 Subject: [PATCH] * Moved the multi-menu in a separate module so we don't automatically get those features (save time for many of us!) * Fixed the inactive parent function names * Mark the top links with 'simplemenu_multi_menu_root' --- simplemenu.admin.inc | 8 ++++---- simplemenu.module | 6 +++--- simplemenu_inactive_parents.module | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/simplemenu.admin.inc b/simplemenu.admin.inc index 2b7be851..b3eb97e0 100644 --- a/simplemenu.admin.inc +++ b/simplemenu.admin.inc @@ -21,13 +21,13 @@ function simplemenu_admin_settings() { ); if (module_exists('menu')) { - $form['default_menu']['simplemenu_menus'] = array( + $form['default_menu']['simplemenu_menu'] = array( '#type' => 'select', - '#multiple' => TRUE, '#title' => t('Menu'), '#options' => menu_parent_options(menu_get_menus(), array('mlid' => 0)), // return complete tree - '#default_value' => variable_get('simplemenu_menus', array('navigation:0')), - '#description' => t('Select the menu to display. Select multiple menus to show each one of them (use Ctrl or Shift to select multiple entries.) Please, avoid selecting a parent and a child from the same menu.'), + '#default_value' => variable_get('simplemenu_menu', 'navigation:0'), + '#description' => t('Select the menu to display.'), + '#weight' => -1, ); } diff --git a/simplemenu.module b/simplemenu.module index 8d49d8a3..e5bee361 100644 --- a/simplemenu.module +++ b/simplemenu.module @@ -283,9 +283,8 @@ function simplemenu_get_menu() { // if a user turned off menu module but SimpleMenu was previously set // reset variable so a menu appears $all_menus = array('navigation:0'); - if (module_exists('menu')) { - $all_menus = variable_get('simplemenu_menus', $all_menus); - } + drupal_alter('simplemenu_menus', $all_menus); + if (count($all_menus) > 1) { // if menu is not enable then we cannot have a count other than 1 $menu_titles = menu_get_menus(); @@ -294,6 +293,7 @@ function simplemenu_get_menu() { list($menu_name, $mlid) = explode(':', $full_name); $tree[] = array( 'link' => array( + 'simplemenu_multi_menu_root' => TRUE, 'mlid' => $mlid, 'menu_name' => $full_name, 'hidden' => FALSE, diff --git a/simplemenu_inactive_parents.module b/simplemenu_inactive_parents.module index 85cf8cd2..28daff6a 100644 --- a/simplemenu_inactive_parents.module +++ b/simplemenu_inactive_parents.module @@ -22,16 +22,16 @@ * is built by the system (i.e. caches are cleared by user, * because a module is installed, etc.) */ -function simplemenu_theme_registry_alter(&$theme_registry) { +function simplemenu_inactive_parents_theme_registry_alter(&$theme_registry) { global $theme; // Save theme function - $themes = variable_get('simplemenu_theme_function', array()); + $themes = variable_get('simplemenu_inactive_parents_theme_function', array()); $themes[$theme] = $theme_registry['menu_item_link']['function']; - variable_set('simplemenu_theme_function', $themes); + variable_set('simplemenu_inactive_parents_theme_function', $themes); // Replace with our own - $theme_registry['menu_item_link']['function'] = 'simplemenu_theme_menu_item_link'; + $theme_registry['menu_item_link']['function'] = 'simplemenu_inactive_parents_theme_menu_item_link'; } /** @@ -40,7 +40,7 @@ function simplemenu_theme_registry_alter(&$theme_registry) { * This function intercepts the menu item link theming function of * the system and */ -function simplemenu_theme_menu_item_link($link) { +function simplemenu_inactive_parents_theme_menu_item_link($link) { global $theme; static $cnt = 0; @@ -51,7 +51,7 @@ function simplemenu_theme_menu_item_link($link) { } // got a theme function? - $themes = variable_get('simplemenu_theme_function', array()); + $themes = variable_get('simplemenu_inactive_parents_theme_function', array()); if (isset($themes[$theme])) { return $themes[$theme]($link); }