The <li> tags of a rendered menu should have "first" and "last" classes assigned to them to assist in theming and to be consistent with the built-in menu module.

I'll upload a patch to do this shortly.

CommentFileSizeAuthor
#1 imagemenu-772424.patch2.39 KBshawn_smiley

Comments

shawn_smiley’s picture

StatusFileSize
new2.39 KB

Here is a patch to add the "first" and "last" classes to the menu output.

godo’s picture

Thanks. It's working fine. Is it possible to add this patch to core module?

It would be nice to have different "tags" classes for every item and not only for the "first" and "last" classes to the menu output. It is only a suggestion ;-)

Thanks again.

shawn_smiley’s picture

Status: Active » Needs review

Can you elaborate on what you would like to see related to additional classes on the tags?

godo’s picture

OK,

The <li> tags of a rendered menu should have "first" and "last" classes assigned to them to assist...

So,
The "second" <li> tag of a rendered menu should have "second" class assigned to it to assist...
The "third" <li> tag of a rendered menu should have "third" class assigned to it to assist...
...

shawn_smiley’s picture

What would be the use-case for adding the classes second, third, fourth, etc?

I haven't seen that done anywhere in Drupal core or any other contributed module.

I could see a use-case for adding even/odd classes though.

godo’s picture

If I want to have a horizontal bar menu, I have to place with css properties every "image-button" of the menu, so:

first image menu second image menu third image ... <--- horizontal bar menu

..., I need to have different "tags" classes for every item, for example, assign differents "margin-left" and "margin-top" properties.

Thanks.

marcus_clements’s picture

Status: Needs review » Fixed

I've added first and last classes, even and odd classes and a unique class per menu item in the form imagemenu-item-N where N is the id.

The code is comitted to 6.x-1.x-dev

The nightly snapshot should contain this fix. Please test and advise.

shawn_smiley’s picture

I just updated our site with the latest dev release and everything looks good.

Thanks.

Status: Fixed » Closed (fixed)

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