* 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:
parent
4430806082
commit
03cc8469dc
@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user