I've been trying to create a Nice Menu that displays only child menu items of a chosen main menu item/trail. According to this (6.x) issue: http://drupal.org/node/135771, it should be possible to manipulate the starting depth of a Nice Menus block using advanced theming in 7.x too. I've found this snippet for 6.x: http://drupal.org/node/236418#comment-4256956, which seems to do the trick, but it doesn't seem to fly for 7.x.
I'm hoping someone - with better advanced theming skills than mine - is able to write up an example of how to manipulate starting level/depth of a Nice Menus block.
Thanks in advance!
Comment | File | Size | Author |
---|---|---|---|
#13 | nice_menus-n1298114-13.patch | 2.27 KB | DamienMcKenna |
#8 | nice_menus_starting_level-1298114-8.patch | 1.39 KB | adrianopulz |
#7 | nice_menus-starting_level-1298114-7.patch | 1.79 KB | makangus |
#6 | 1298114.6-starting_level.diff | 1.47 KB | makangus |
Comments
Comment #1
Robert DeArmond CreditAttribution: Robert DeArmond commentedSubscribing. I found the same thread, but it is a no go in D7
Comment #2
chibichan CreditAttribution: chibichan commentedMe, too, I am currently learning about Drupal 7, hoping we can upgrade our site soon to 7.
Then I have come across to this problem.....
Comment #3
vordude CreditAttribution: vordude commentedYup, this got left out of the port to 7 for one reason or another. I'm redirecting other dupe issues here.
Comment #4
jenlamptonadding that #1172786: Feature missing from D7 version: Select menu parent (level) has been marked as dupe of this issue.
Comment #5
ko-sh CreditAttribution: ko-sh commentedAs as simple/quick solution:
you can use the menu block module to create this menu and then apply the JavaScript of Nice Menu to the menu_block. In fact you only have to change the names of the classes in the menu_block. This is not a perfect solution but the best i came up with after having the same problem.
$('.menu-block-wrapper ul.menu').addClass('nice-menu nice-menu-right sf-js-enabled').removeClass('menu');
Comment #6
makangus CreditAttribution: makangus commentedAttached patch to backport to feature from d6 to d7
Comment #7
makangus CreditAttribution: makangus commentedCleaned up the patch
Comment #8
adrianopulzUpdate for patch posted in comment #7.
I tried to apply but did not work. This is Fixed version.
Comment #9
granticusiv CreditAttribution: granticusiv commentedThanks guys! I used your updated patch adrianopulz, and it worked perfectly. Just had to go into each nice menu block and save each one again to get rid of the 'undefined' error that was popping up.
Comment #10
goye2cz CreditAttribution: goye2cz commentedVery interesting patch. granticusiv is right, you have to go in and save EVERY nice menu block again. Makes sense in hindsight. Does this feature really not exist in the D7 version? Seems a little surprising to me.
One suggestion I would make, keep in mind, I am not a coder so take it with a grain of salt: I think it could be good to be able to select the starting depth rather than the starting menu item.
Many thanks for this patch until you are better paid. :)
Comment #11
adrianopulzThanks!
Comment #12
PascalMortier CreditAttribution: PascalMortier commentedThis solution #5 works for me, but I add this to add the 'over' class to the parent so you can customize the parent by css in case you hover a child item.
$('ul.nice-menu').superfish({
// Apply a generic hover class.
hoverClass: 'over',
// Disable generation of arrow mark-up.
autoArrows: false,
// Disable drop shadows.
dropShadows: false,
// Mouse delay.
delay: Drupal.settings.nice_menus_options.delay,
// Animation speed.
speed: Drupal.settings.nice_menus_options.speed
// Add in Brandon Aaron's bgIframe plugin for IE select issues.
// http://plugins.jquery.com/node/46/release
}).find('ul').bgIframe({opacity:false});
$('ul.nice-menu ul').css('display', 'none');
It depends on the place where you or your theme places the script. In some cases you have to add the above to make it work, in other cases not.
Comment #13
DamienMcKennaThis is an updated version of the patch from #8 that updates all existing nice_menus block definitions to match the new format by adding a ":0" suffix to them.
FYI while looking through the code I noticed that the module was already partly set up to do this, e.g. the default menu it uses is "navigation:0", which matches the new format, rather than "navigation" which the current codebase would expect.
Comment #14
xiukun.zhou CreditAttribution: xiukun.zhou commentedThanks a lot to DamienMcKenna, makangus and everyone else for the great work on the patches, testing, reviews and reporting.
It's more time this got committed and I went ahead and had this rolled at: 7.x-2.x: d52a7ad.
Marking this as fixed.
Please let me know if you would have any other questions, comments, issues or concerns on any of these changes, I would be glad to provide more information.
Thanks again to everyne for the help and great work on this issue.
Cheers!
Comment #15
xiukun.zhou CreditAttribution: xiukun.zhou commented