Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi, using 7.x-2.x-dev and Context UI. Using the Context module to set an "active menu", but the nicemenus does not get the 'active-trail' class (or any active CSS class).
Is there a solution?
Comment | File | Size | Author |
---|---|---|---|
#11 | context_active_menu-1331264-11.patch | 1.52 KB | altrugon |
#9 | context_active_menu-1331264-9.patch | 2.1 KB | DuaelFr |
#5 | context_active_menu-1331264-4.patch | 1.77 KB | altrugon |
#3 | context_active_menu-1331264-3.patch | 1.62 KB | altrugon |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedThey're trying to solve this on the Context UI side,
#586396: Context Active menu problem
Comment #2
Anonymous (not verified) CreditAttribution: Anonymous commentedSolution: in nice_menus.module, inside theme_nice_menus_build()
Comment #3
altrugon CreditAttribution: altrugon commentedTaking the solution mentioned on comment #2 as a guide I have created a patch that not only set the class "active-trail" but also the class "active" for the link.
This patch has been created from the master branch that is the recommended release 7.x-2.0.
Comment #4
altrugon CreditAttribution: altrugon commentedComment #5
altrugon CreditAttribution: altrugon commentedClassic, I upload the patch and then apply it from here and it doesn't work.
Second try, and this one solves a problem with undefined index that the previous patch had.
Comment #6
BarisW CreditAttribution: BarisW commentedCool. Patch works great. Thanks!
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commented#5 worked for me!
Comment #8
vordude CreditAttribution: vordude commentedI'm inclined to think we could be better off in adding an active class where one belongs instead of creating specific code that works with 1 other specific contributed module? (albeit a popular one)
Comment #9
DuaelFr@vordude I agree but waiting for the better solution, this one works ;)
@altrugon Your patch does not seems to activate selected menu parents. Here is a new improved patch based on yours.
Comment #10
osopolarMaybe this fixes this issue: #835090: Context Reaction: Set menu trail
Comment #11
altrugon CreditAttribution: altrugon commentedI can't believe this hasn't been fixed yet, my last post was submitted in 2011 and neither Nice Menu or Context have solved it yet :(
Anyhow here goes another patch against Nice Menu 7.x-2.1 that is the stable release at this moment.
Comment #12
xiukun.zhou CreditAttribution: xiukun.zhou commentedThanks a lot to altrugon, DuaelFr, morningtime 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: 6969cde.
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!