Just like some other theme_* functions
, it would be handy if theme_item_list
had a $attributes
parameter.
As this is a fairly low-level themeable function, it tends to be used by higher-level functions in custom themes, and this would allow custom themes to rely on it while adding the ability to customize list display by passing attributes to be applied on the chosen list.
An incorrect workaround I've seen applied is to pass a third parameter like ul class="someclass"
, but this causes the function to generate incorrect HTML because the attribute string is carried into the element closure where it doesn't belong.
I'm therefore suggesting a patch for this feature. Discussion on IRC seems to suggest that, if this is agreeable to core maintainers, it might be useful to generalize this $attributes
parameter to a larger number of theme functions.
Comment | File | Size | Author |
---|---|---|---|
theme.inc_6.patch | 1.11 KB | fgm | |
Comments
Comment #1
drummStill doesn't allow attributes on
<li>
tags, but better than nothing. I added a '.' at the end of the added documentation.Committed to HEAD.
Comment #2
fgmI thought about it, and thought it was generic enough: the attribute for the list element can be a class or id, which allow for styling the list-item elements by including the class/id in a selector.
Comment #3
(not verified) CreditAttribution: commented