The first module that I would like to submit is extremely simple, but useful. The last few sites that I have worked on have used some form of the CSS Sprite technique for all front-end navigation elements, and I needed a way to differentiate between different menu elements with css rules. I could have used the menu_attributes module, but that would have required me to manually enter in class names for each menu item. Instead, I wrote a small module that uses a theme registry override to automatically add class names to the menu's <li> elements, based on the menu title (but with all non-alphanumeric, dash, and underscore characters replaced with dashes, and all letters converted to lowercase). It works great!
[Edited by KiamLaLuno to escape the HTML tag <li> that was rendered]
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | menu_css_names.tgz | 1.67 KB | rc_100 |
| #1 | menu_css_names.tar_.gz | 1.4 KB | rc_100 |
Comments
Comment #1
rc_100 commentedComment #2
avpadernoSearching for CSS Sprites, I obtained a list of many modules; did you think of join forces with one of those projects?
Comment #3
rc_100 commentedYes, I did consider going that route, however, sometimes I just want to be able to add a css style to particular menu elements in the
<ul>structure (and not others). Other times, I want to do CSS Sprites with the menu structure. So my thinking was that it would be good to have a more general-purpose module that allowed for either case, rather than limiting it to CSS Sprites.[Edited by KiamLaLuno to show the hidden HTML tag added in the comment]
Comment #4
rc_100 commentedComment #5
avpadernoThe module should use Drupal Unicode functions.
Comment #6
rc_100 commentedHello Kiam,
I've replaced the strlower() function with the drupal_strlower() unicode-compatible function - thanks for catching that.
Comment #7
avpadernoComment #9
avpaderno