views:

82

answers:

3

On my Drupal site I've got a set of Primary Links. The ones that expand I'd like to make the parent not click able e.g

  -home
  -about
    -history
    -website

Only home, history, website should link to a page. If the user clicks on aboutnothing should happen. I've tried searching around the admin panels as well as leaving the field blank but it doesn't seem to be working. I'd assume I'd have to hardcode this? If so, how?

A: 

If you can live with it, the easiest solution is to use js to disable clicks.

googletorp
How would I do that for a single item on a Primary Links menu?
Ulkmun
A: 

Adding a yourtheme_menu_item function in template.php seems to be the way to go for this. The documentation for the original function is at http://api.drupal.org/api/function/theme_menu_item

The function passes a $has_children variable and a $menu variable, so it should be pretty easy to adjust Primary Menu items with children as needed.

Some untested example code:

function yourtheme_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) {
  // ... original theme code copy-pasted ...
  if ($has_children) {
    $modified_link_name = youtheme_write_menu_item_without_links($link);
    return '<li class="'. $class .'">'. $modified_link_name ."</li>\n";
  } else {
    // From original function
    return '<li class="'. $class .'">'. $link . $menu ."</li>\n";
  }
}
anschauung
This will alter ALL menus on the site. Will almost certainly give problems.
googletorp
+1  A: 

Try this module http://drupal.org/project/special_menu_items

Its probably the simplest way to achieve what you want.

Sid NoParrots