Closed (fixed)
Project:
Drupal core
Version:
6.x-dev
Component:
menu system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Dec 2007 at 05:19 UTC
Updated:
17 Apr 2009 at 07:38 UTC
When secondary links' source is primary links, it would be useful to know down the road (for theming purposes) which of the primary links is in the active path. All the new menu stuff rocks, and I read through this, but it appears one of my main frustrations theming primary/secondary links is still around -- namely, that parents of the active item are not marked as such.
I wrote a quick patch to deal with this, by adding a in_active_trail key to the links in the array generated by menu_navigation_links. The patch includes the addition of an in-active-trail class when theming links.
| Comment | File | Size | Author |
|---|---|---|---|
| menu_navigation_active_trail.patch | 1.24 KB | davideads |
Comments
Comment #1
davideads commentedComment #2
birdmanx35 commentedThis is a feature request, and feature requests go to 7.x-dev.
If this makes it easier for themers to theme, then +1!.
Comment #3
davideads commentedI filed this more than a month ago, when it certainly was not a feature request. It is a small patch, but important for a project I'm working on, and it is a not simply a feature request but a logical inconsistency that has bothered me about Drupal since I started using it in version 4.7. It could have taken 10 minutes for someone else to triage and commit. I mentioned it several times in #drupal, and a colleague of mine also tried to get someone to look at it.
I don't begrudge any FLOSS maintainer their job, and deeply respect the work done on Drupal. But we should be honest here: For the next year or two, I am now going to have to maintain a patch against all my D6 sites or recreate a lot of functionality for a tiny but crucial affordance (proper hierarchical navigation is important) and no longer have the full benefit of the community process.
Properly, this is a small bug, and we should mark it as a bug for 6.x, mark wontfix, and consider how we should approach the problem as part of the holistic D7 UI renovation project which Dries has alluded to recently.
Comment #4
webchickI think the original author won't fixed this incorrectly. Changing it back to 7.x and code needs review, since it still applies with some offsets.
@davideads: Drupal core development goes through three primary phases:
Therefore, it's not that your patch is "won't fix"; it simply came too late during the 6.x development cycle to be applied.
The good news is that 7.x is in that wide-open "development" phase, so now's the perfect time to push this again. And although it's a pain to maintain a hacked version of core for this release, if this patch gets applied to 7.x, at least you'll eventually be able to do without that customization, as it'll be rolled in for you.
Comment #5
pwolanin commentedpatch has fuzz and should be rerolled. Seem like a basically good idea, though I'm not sure it's the best possible implementation. As a caveat, the rendering of Primary/secondary links in the page theme may change substantially for 7.
Anyhow, if you are really desperate to have this for 6.x without hacking core, you should be able to write a module to:
1) implement hook_menu, set $item['options']['alter'] to TRUE for everything in the chosen primary links menu.
2) implement hook_translated_menu_link_alter() and set a flag as you desire in $item['translated_options'] if $item['in_active_trail']
Comment #6
gpk commented@pwolanin: a neat trick, albeit a bit of a fudge :-P
Presumably you mean 1) implement hook_menu_link_alter?
[Update]
@davideads: I'd suggest one tiny change: in theme_links(), use class "active-trail" instead of "in-active-trail", for consistency with http://api.drupal.org/api/function/theme_menu_item/6.
No harm in getting this into 7.x now even if there are plans for improved primary links.
Also I think the one line addition to menu_navigation_links() is suitable for inclusion in D6; theme_links() can always be re-implemented within a theme, and changing that function now could potentially foul up existing D6 themes.
Comment #7
gpk commentedFixed in 6.x-dev (and 7.x-dev) http://drupal.org/node/249571.
Comment #8
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #9
caktux commentedThis is still happening when on an active sub-page, primary links don't get the active class and $primary_links don't carry it either. This issue is also a duplicate of http://drupal.org/node/249571. I've post a patch on 6.10 there, mostly just the menu.inc one liner.