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!

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Robert DeArmond’s picture

Subscribing. I found the same thread, but it is a no go in D7

chibichan’s picture

Me, 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.....

vordude’s picture

Component: Documentation » Code
Category: feature » bug
Priority: Normal » Major

Yup, this got left out of the port to 7 for one reason or another. I'm redirecting other dupe issues here.

jenlampton’s picture

adding that #1172786: Feature missing from D7 version: Select menu parent (level) has been marked as dupe of this issue.

ko-sh’s picture

As 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');

makangus’s picture

Status: Active » Needs review
FileSize
1.47 KB

Attached patch to backport to feature from d6 to d7

makangus’s picture

Cleaned up the patch

adrianopulz’s picture

Status: Needs review » Patch (to be ported)
Issue tags: +patch, +#D7, +nice_menus
FileSize
1.39 KB

Update for patch posted in comment #7.
I tried to apply but did not work. This is Fixed version.

granticusiv’s picture

Thanks 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.

goye2cz’s picture

Very 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. :)

adrianopulz’s picture

Thanks!

PascalMortier’s picture

This 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.

DamienMcKenna’s picture

Version: 7.x-2.0 » 7.x-2.x-dev
Status: Patch (to be ported) » Needs review
FileSize
2.27 KB

This 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.

xiukun.zhou’s picture

Status: Needs review » Closed (fixed)

Thanks 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!

xiukun.zhou’s picture

Status: Closed (fixed) » Fixed

Automatically closed -- issue fixed for 2 weeks with no activity.