Hi,
currently single menu items are cosidered as last items in the list.
Would it be possible to consider them also as first items?
I don't know if the attached patch can break some themes, alternatively marking single menu items as single-menu-item could work as well, as suggested in [#138656].
Regards,
Antonio
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | drupal-single-menu-item-both-first-and-last__d6.patch | 1001 bytes | andypost |
| #9 | drupal-single-menu-item-both-first-and-last_d7_v4.patch | 986 bytes | andypost |
| #6 | drupal-single-menu-item-both-first-and-last_d7_v3.patch | 782 bytes | ao2 |
| #4 | drupal-single-menu-item-both-first-and-last_d7_v2.patch | 634 bytes | ao2 |
| drupal-single-menu-item-both-first-and-last.patch | 677 bytes | ao2 |
Comments
Comment #1
mr.baileysRan into the same issue today. I'd classify this as a bug. If a menu item is the first, it should have the class "first", if it's the last item it should have a class "last", and if it's the only item, it should have both classes.
Current practice is to fix this in 7.x-dev first though, and then backport it to D6.
Not sure about:
Feels a bit messy since $extra_class might be NULL and the space is only required in very specific circumstances (single-item menu) anyway. What about treating $extra_class as an array:
Comment #2
ao2 commentedYes that will work as well, or if we want to use the same style used in theme_item_list, we could do:
Regards,
Antonio
Comment #3
mr.baileysThat looks cleaner than my solution. Would you mind rolling a new patch?
Comment #4
ao2 commentedOk,
I rebased the code above to apply cleanly on drupal7, the patch still applies to drupal6 tho.
Regards,
Antonio
Comment #6
ao2 commentedMmh, the System Message says ...
I guess it's because the patch I sent was made with quilt which put also the parent directories in paths (which, in general, is good IMHO), let's try with a 'p0' patch as it expects.
Regards,
Antonio
Comment #7
andypostanother great patch, tested and this works as expected ... now theme can check for this case.
RTBC
Comment #8
dries commentedWe usually add the classes to an array, and than we simply explode them. Sounds like it would be more elegant. One more re-roll?
Do we have tests for this, or do we feel that is unnecessary?
Comment #9
andypostSuppose better reroll to unify :)
I see nothing to test...
Comment #10
dries commentedCommitted to CVS HEAD! Moving version number. Thanks Andy.
Comment #11
andypostSo here reroll for d6
Comment #12
ao2 commentedHi, will this be added to D6 as well?
Thanks,
Antonio
Comment #13
andypostIf anyone review this - patch still applies cleanly
So add a tag
Comment #14
hefox commentedPatch works for me. :)
Comment #15
pvasili commented#11 - good patch
Please use it for 6 versions!
Comment #16
ao2 commentedPing.
Can we have this in next Drupal6 release?
Thanks,
Antonio
Comment #17
andypostThere are more then 2 people test this so suppose RTBC
Comment #18
gábor hojtsyGreat, committed to Drupal 6 too, thanks.