* 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'
This commit is contained in:
Alexis Wilke 2010-05-16 23:20:01 +00:00
parent 4430806082
commit 03cc8469dc
3 changed files with 13 additions and 13 deletions

View File

@ -21,13 +21,13 @@ function simplemenu_admin_settings() {
); );
if (module_exists('menu')) { if (module_exists('menu')) {
$form['default_menu']['simplemenu_menus'] = array( $form['default_menu']['simplemenu_menu'] = array(
'#type' => 'select', '#type' => 'select',
'#multiple' => TRUE,
'#title' => t('Menu'), '#title' => t('Menu'),
'#options' => menu_parent_options(menu_get_menus(), array('mlid' => 0)), // return complete tree '#options' => menu_parent_options(menu_get_menus(), array('mlid' => 0)), // return complete tree
'#default_value' => variable_get('simplemenu_menus', array('navigation:0')), '#default_value' => variable_get('simplemenu_menu', '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.'), '#description' => t('Select the menu to display.'),
'#weight' => -1,
); );
} }

View File

@ -283,9 +283,8 @@ function simplemenu_get_menu() {
// if a user turned off menu module but SimpleMenu was previously set // if a user turned off menu module but SimpleMenu was previously set
// reset variable so a menu appears // reset variable so a menu appears
$all_menus = array('navigation:0'); $all_menus = array('navigation:0');
if (module_exists('menu')) { drupal_alter('simplemenu_menus', $all_menus);
$all_menus = variable_get('simplemenu_menus', $all_menus);
}
if (count($all_menus) > 1) { if (count($all_menus) > 1) {
// if menu is not enable then we cannot have a count other than 1 // if menu is not enable then we cannot have a count other than 1
$menu_titles = menu_get_menus(); $menu_titles = menu_get_menus();
@ -294,6 +293,7 @@ function simplemenu_get_menu() {
list($menu_name, $mlid) = explode(':', $full_name); list($menu_name, $mlid) = explode(':', $full_name);
$tree[] = array( $tree[] = array(
'link' => array( 'link' => array(
'simplemenu_multi_menu_root' => TRUE,
'mlid' => $mlid, 'mlid' => $mlid,
'menu_name' => $full_name, 'menu_name' => $full_name,
'hidden' => FALSE, 'hidden' => FALSE,

View File

@ -22,16 +22,16 @@
* is built by the system (i.e. caches are cleared by user, * is built by the system (i.e. caches are cleared by user,
* because a module is installed, etc.) * because a module is installed, etc.)
*/ */
function simplemenu_theme_registry_alter(&$theme_registry) { function simplemenu_inactive_parents_theme_registry_alter(&$theme_registry) {
global $theme; global $theme;
// Save theme function // 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']; $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 // 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 * This function intercepts the menu item link theming function of
* the system and * the system and
*/ */
function simplemenu_theme_menu_item_link($link) { function simplemenu_inactive_parents_theme_menu_item_link($link) {
global $theme; global $theme;
static $cnt = 0; static $cnt = 0;
@ -51,7 +51,7 @@ function simplemenu_theme_menu_item_link($link) {
} }
// got a theme function? // got a theme function?
$themes = variable_get('simplemenu_theme_function', array()); $themes = variable_get('simplemenu_inactive_parents_theme_function', array());
if (isset($themes[$theme])) { if (isset($themes[$theme])) {
return $themes[$theme]($link); return $themes[$theme]($link);
} }