I’m currently in the process of porting over the theme here to Drupal 5.0 and noticed a slight difference between 4.7 and 5.0. While I was able to use something like this in my template.php before:
function mytheme_menu_item_link($item, $link_item) { static $menu; $attribs = isset($item['description']) ? array('title' => $item['description']) : array(); if ('<front>' == $link_item['path'] && ( arg(0)=='node' && ( (is_numeric(arg(1)) && arg(1) != 213) || arg(1)=='' ) ) ){ $attribs['class'] = 'active'; } return l($item['title'], $link_item['path'], $attribs); }
…which is then integrated with theme('links',$primary_links)
in the page.tpl.php.
This is now longer possible since the theme_links function now expects a structure for each link instead of the complete HTML link. Now you have to override the whole theme_links function instead since you won’t otherwise be able to access the structure of the generated links in this menu before they’re getting rendered.
Not really an optimal solution for me but I guess it falls under “good enough” since the extra class I add to the link shouldn’t be all that bad. Anyway: If someone has found a different solution, please let me know :-)
Do you want to give me feedback about this article in private? Please send it to comments@zerokspot.com.
Alternatively, this website also supports Webmentions. If you write a post on a blog that supports this technique, I should get notified about your link π