19th Street Design is now Greg Willis Industries!
Head on over to the new website for updated information and the new contact form. I'll keep this old website up until the summer of 2012. Make sure you update your links to the new site. Thanks!
Drupal Menu IDs
One of the first things I do when customizing a Drupal install is to add CSS IDs to the menu items. At some point you're usually going to have to do something with the menu items, so it's nice to have the handles already in place for the grabbing. You drop the following code into your template.php file.
<?php
function phptemplate_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) {
$class = ($menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf'));
if (!empty($extra_class)) {
$class .= ' '. $extra_class;
}
if ($in_active_trail) {
$class .= ' active-trail';
}
$id = preg_replace("/[^a-zA-Z0-9]/", "", strip_tags($link));
return '<li id="'.$id.'" class="'. $class .'">'. $link . $menu ."</li>\n";
}
?>On this site this code gives me id="menu-home" etc. for the items in the main nav. Using this I swap the text out for a png image to get the font all proper. Got this from drupal.org, Add unique IDs to menu items.