Posted by muckermarc on July 8, 2009 at 4:12pm
| Project: | Calendar |
| Version: | 6.x-2.2 |
| Component: | User interface |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
Hello,
Not sure if this is a core Drupal issue, or with the Calendar module... I'm trying to style $calendar_links[] - i.e. the links at the top of a Calendar page with text "Week, Day, Add+".
The HTML produced is:
<ul class="links">
<li class="0 first">
<a rel="nofollow" href="/calendar/2009-W28">Week</a>
</li>
<li class="1">
<a rel="nofollow" href="/calendar/2009-07-08">Day</a>
</li>
<li class="2 last">
<a rel="nofollow" href="/node/add/show?destination=calendar/2009-07-08">Add+</a>
</li>
</ul>Ideally I want to style each li element individually (to drop in a graphical background image as a button). However the class names each have a numeric identifier (0,1,2 etc) which is not valid CSS and is ignored by Firefox.
Any ideas on how I can over-ride the numeric class names and use text-based ones (cal0, cal1, cal2 for example)?
Cheers, M
Comments
#1
I'm also having this problem. Looking into it, I see that the calendar-main.tpl.php file calls theme().
<?php if (empty($block)) print theme('links', $calendar_links);?>Looking at the Drupal API, theme() with the hook of 'links' appears to be the same thing as calling theme_links(). So, looking at theme_links(), one finds the culprit in the foreach() loop for the li items which sets the class as the numeric key.
The solution is to override them_links() in your template.php of your theme.
#2
Hi Fred0,
Many thanks for the tip - I ended up styling all the links the same on that particular site, but will use your technique in future sites.
Cheers,
Marc
#3
The attached patch adds explicit array keys instead of simply passing numeric keys. This will allow more targeted styling of these links w/o having to override any theme functions.
#4
Thanks, this works great for me! Is there any way to determine which one should be active so that one could be hilighted? I've often wondered why these aren't themed as tabs.
#5
Finally got this committed. Thanks!
#6
Automatically closed -- issue fixed for 2 weeks with no activity.