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 guys,
Do you know that the class="expanded" is added just and only because a menu has $data['below'] set? That does not mean it has any items below itself since all of those could be hidden.
The only I can see is to generate the element '#below' field and check the result instead of testing $data['below'].
I'm attaching a patch to give you an idea of what I'm talking about.
Thank you.
Alexis Wilke
Comment | File | Size | Author |
---|---|---|---|
#13 | menu-expanded_class_2-7.x.patch | 1.35 KB | AlexisWilke |
#10 | menu-expanded_class_2-7.x.patch | 1.32 KB | AlexisWilke |
#4 | 813736_fix_expanded_class.patch | 1.25 KB | apaderno |
menu-expanded_class-7.x.patch | 1.17 KB | AlexisWilke | |
Comments
Comment #2
AlexisWilke CreditAttribution: AlexisWilke commentedmenu-expanded_class-7.x.patch queued for re-testing.
Comment #4
apadernoI re-rolled the patch.
Comment #6
apaderno#4: 813736_fix_expanded_class.patch queued for re-testing.
Comment #7
retester2010 CreditAttribution: retester2010 commented#4: 813736_fix_expanded_class.patch queued for re-testing.
Comment #9
mertskeli CreditAttribution: mertskeli commentedhttp://drupal.org/node/886988
Comment #10
AlexisWilke CreditAttribution: AlexisWilke commentedWow! For once the failure is real... I little more, I'll be impressed. Although the spelling is still funky. 8-)
I'm offering a new patch. The other change was not helping much with this problem as noticed by mertskeli.
Thank you.
Alexis
Comment #11
AlexisWilke CreditAttribution: AlexisWilke commentedHmmm... It looks like the new patch won't be checked by the system, right?! Do I have to post it again?
Comment #13
AlexisWilke CreditAttribution: AlexisWilke commentedRhaaa... wrong path. 8-P
Comment #14
mertskeli CreditAttribution: mertskeli commentedSorry if I'm wrong, but probably it is a problem with menu items treating actions-links as children. It's not only about "expanded", it affects "collapsed" as well. It's a D7 bug (was not present in D5 and D6).
Comment #15
AlexisWilke CreditAttribution: AlexisWilke commentedIt is definitively a D7 bug. The code has changed quite a bit. But I could not tell you whether "collapsed" is affected. I had problems with simplemenu and this fixes them.
Thank you.
Alexis
Comment #16
Damien Tournoud CreditAttribution: Damien Tournoud commentedThis basically restores a band-aid that we had in Drupal 6... it doesn't fix the real issue at all.
Comment #17
AlexisWilke CreditAttribution: AlexisWilke commentedDamien,
Could you describe what the real issue is? Pretty please?
Thank you!
Alexis
Comment #18
mertskeli CreditAttribution: mertskeli commentedSeems like it has been fixed. But do not know how, by whom and when.
Alexis, could you confirm?
Comment #19
jelo CreditAttribution: jelo commentedCan you please elaborate on how Drupal 6 is affected by this? In my case a parent menu item that has an unpublished child gets the class "collapsed" although it should get a "leaf" class. If it was fixed in 7, will there be a fix for 6?
Comment #20
AlexisWilke CreditAttribution: AlexisWilke commentedjelo,
D6 is not going to be fixed for such problems, I don't think.
The class collapsed is better than expanded when there are not children at all to show.
I have not been testing with D7 in a while, so I do not know whether it is fixed. Once I have git access, I will be testing some menu related modules so I may have a minute to come back to this one.
Thank you,
Alexis
Comment #21
jelo CreditAttribution: jelo commentedThanks, that would be great. Damien mentioned that there has been some larger problem with this in D6 and a bandaid solution. Could someone please briefly mention what the underlying problem is? Apparently, the menu already checks for each menu item if there is a child, but that does not seem to include if the child is published or not. Wouldn't it be sufficient to add the check for the status of the child?
Comment #22
johnvThe following issues are related, if not duplicates:
#813736: Many menu without 'visible' children items are marked with class="expanded"
#1760824: A parent Menu item with unpublished children gets the class "collapsed" or "last collapsed active trail"
Comment #23
mgifford@AlexisWilke's patch no longer applies.