Closed (outdated)
Project:
Superfish Dropdown Menu
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
20 Oct 2011 at 20:33 UTC
Updated:
24 Apr 2025 at 05:09 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
mehrpadin commentedHoi Yuri,
I guess you're using v1.8-beta2 .
Comment #2
Yuri commentedNo, I'm using the most recent version 1.8
If you refer to the "menu parent" selection box available in Superfish, that is something different than what I mean.
Menu Block uses "starting level" which works dynamically, it shows menu items if they are on the selected level or lower and the menu will show the items if they have the active_trail class.
This is different from the menu parent selection box which can only select one parent in one branch.
Comment #3
mehrpadin commentedOh! I got it, sure, added to my to-do list, thank you! really!
Comment #4
flatcircle commentedI this already a feature in the latest version? (7.x-1.8)
Is it possible to not only set the menu depth but also the starting level?
Regards.
Comment #5
mehrpadin commentedHey,
Not yet, with 1.9-beta5 hopefully.
:)
Comment #6
sigurdur commentedHi, I'm facing the same problem.
I'm using taxonomy, with Taxonomy Menu to split my site into sections, i.e. with the top level terms in a section menu at the top and then a split menu, using the same vocabulary, but level 2 and below for navigation in each section. This is possible with Menu Block, but I would prefer using Superfish. Any news on this?
Best regards,
Sigurdur
Comment #7
softone commentedHi.
It seems it's not yet included in 1.9-beta5.
This would be a very good and valuable addition to the Superfish features :-)
Regards.
Comment #8
shortspoken commentedSubscribing +
Would be an awesome feature!
Cheers, Moritz
Comment #9
McGrathOS commentedSubscribing
Comment #10
rudetrue commentedSubscribing
Comment #11
BartNijs commentedSubscribing. Need this feature as well.
Any alternatives for now?
Comment #12
sherpadawan commentedI'm very sorry for this quick and dirty work, but hopefully it'll kickass somebody to do it. The thing is that menu block is great, is there any integration between both superfish and menu block ? Maybe the reflexion is higher level anyway ...
start level is : the level from the selected menu root level (pretty bad usecase coverage)
follow start level is : do you want to see the same thing in the block after clicking on a sublink (very bad usecase coverage as well since it does not show children in case)
that's why i'm wondering about a fusion with menu blocks code ...
here is my patch
diff --git b/src/sites/all/modules/contrib/superfish/superfish.module a/src/sites/all/modules/contrib/superfish/superfish.module old mode 100644 new mode 100755 index 850964f..d0b9b12 --- b/src/sites/all/modules/contrib/superfish/superfish.module +++ a/src/sites/all/modules/contrib/superfish/superfish.module @@ -86,6 +86,19 @@ function superfish_block_configure($delta = 0) { '#default_value' => variable_get('superfish_menu_' . $delta, 'main-menu:0'), '#options' => menu_parent_options(menu_get_menus(), array('mlid' => 0)), ); + $form['sf-menu']['superfish_menu_start_level_' . $delta] = array( + '#type' => 'select', + '#title' => t('Menu starting level'), + '#description' => t('The menu starting level you want to be displayed using Superfish.') . ' (' . t('Default') . ': <0>)', + '#default_value' => variable_get('superfish_menu_start_level_' . $delta, '0'), + '#options' => drupal_map_assoc(range(-1,10)), + ); + $form['sf-menu']['superfish_menu_start_level_follow_' . $delta] = array( + '#type' => 'checkbox', + '#title' => t('Make the starting level follow the active menu item'), + '#description' => t('Make the starting level follow the active menu item') . ' (' . t('Default') . ': <no>)', + '#default_value' => variable_get('superfish_menu_start_level_follow_' . $delta, '0'), + ); $form['sf-menu']['superfish_depth_' . $delta] = array( '#type' => 'select', '#title' => t('Menu depth'), @@ -656,6 +669,8 @@ function superfish_block_configure($delta = 0) { function superfish_block_save($delta = 0, $edit = array()) { variable_set('superfish_name_' . $delta, $edit['superfish_name_' . $delta]); variable_set('superfish_menu_' . $delta, $edit['superfish_menu_' . $delta]); + variable_set('superfish_menu_start_level_' . $delta, $edit['superfish_menu_start_level_' . $delta]); + variable_set('superfish_menu_start_level_follow_' . $delta, $edit['superfish_menu_start_level_follow_' . $delta]); variable_set('superfish_depth_' . $delta, $edit['superfish_depth_' . $delta]); variable_set('superfish_type_' . $delta, $edit['superfish_type_' . $delta]); variable_set('superfish_style_' . $delta, $edit['superfish_style_' . $delta]); @@ -728,6 +743,9 @@ function superfish_contents($delta = 0) { list($menu_name, $mlid) = explode(':', variable_get('superfish_menu_' . $delta, 'main-menu:0')); + $menu_start_level = variable_get('superfish_menu_start_level_' . $delta, 0); + $menu_start_level_follow = variable_get('superfish_menu_start_level_follow_' . $delta, 0); + $sfsettings = $sfoptions = $sfplugins = array(); $sfsettings['depth'] = variable_get('superfish_depth_' . $delta, '-1'); $sfsettings['type'] = variable_get('superfish_type_' . $delta, 'horizontal'); @@ -998,6 +1016,8 @@ function superfish_contents($delta = 0) { 'id' => $delta, 'menu_name' => $menu_name, 'mlid' => $mlid, + 'menu_start_level' => $menu_start_level, + 'menu_start_level_follow' => $menu_start_level_follow, 'sfsettings' => $sfsettings ); if ($output = theme('superfish', $vars)) { @@ -1539,18 +1559,34 @@ function superfish_build_page_trail($page_menu) { */ function theme_superfish($variables) { global $user, $language; - $id = $variables['id']; $menu_name = $variables['menu_name']; $mlid = $variables['mlid']; + $menu_start_level = $variables['menu_start_level']; + $menu_start_level_follow = $variables['menu_start_level_follow']; $sfsettings = $variables['sfsettings']; - $menu = menu_tree_all_data($menu_name); - + if ($menu_start_level == 'none') { + $menu = menu_tree_all_data($menu_name); + } else { + #ugly quick dev! not tested against module regular bahaviour + #get the root element according to the menu_start_level + if ($menu_start_level_follow == '0') { + $at = menu_get_active_trail(); + $active_trail = $at[$menu_start_level]; + } else { + $active_trail = array_pop(menu_get_active_trail()); + } + $children_depth = $active_trail['depth'] + $menu_start_level; + $menu_properties = array( + 'min_depth' => $children_depth, + 'conditions' => array('plid'=>$active_trail['mlid']), + ); + $menu = menu_build_tree($menu_name, $menu_properties); + } if (function_exists('i18n_menu_localize_tree')) { $menu = i18n_menu_localize_tree($menu); } - // For custom $menus and menus built all the way from the top-level we // don't need to "create" the specific sub-menu and we need to get the title // from the $menu_name since there is no "parent item" array. @@ -1914,4 +1950,4 @@ function theme_superfish_menu_item_link($variables) { $menu_item = $variables['menu_item']; $link_options = $variables['link_options']; return l($menu_item['link']['title'], $menu_item['link']['href'], $link_options); -} \ No newline at end of file +}Comment #13
BartNijs commentedsherpadawan,
I added your patch to superfish.module and now it does take the start level into account and only appears if the parent menu item is selected. But I get no depth. The menu only shows items on the same level.
Example to illustrate:
When in a menu block the foo menu item is selected, the superfish block shows menu items A and B. But there's no submenus. The ul's below A and B are missing. When I click on A, the level 1 menu items disappear and make place for the level2 items. Thus showing K, L M and N.
I'm not a coder so I don't know where to start to resolve this issue. But for a first step your solution seems to be on the right path.
Comment #14
blackiceuaAny solution for this problem? I found work patch on other site, but not remember the website address.
Comment #15
blackiceuaI think, I found solution.
Thanks for sherpadawan!!!
This is my variant of patch:
Comment #16
sreher commentedThanks BlacKICEUA.
I made a patch from this.
I try it and it works. :)
Comment #17
sreher commentedComment #18
tipit commentedPatch #16 works most of the cases but if I set:
1.) Menu starting level to 1 and
2.) Make the starting level follow the active menu item" setting is on
I get an error:
Strict warning: Only variables should be passed by reference in theme_superfish() (line 1810 of .../sites/all/modules/superfish/superfish.module).
Comment #19
tipit commentedComment #20
quixxel commentedThe patch isn't working for me.
I'm getting the same error reported in #18 and the menu isn't starting on a defined level 1 or 2 or 3 ....
It would be very important for me to get the starting-level-feature.
Comment #21
blackiceuaI think that these lines are wrong:
Comment #22
ivnishAutomatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.