Is it possible to implement a function like the following within nice_menus so that parent menu items can be made un-clickable?

function theme_menu_item_link($item, $link_item) {
  if ($item['path'] == '<none>') {
    $attributes['title'] = $link['description'];
    return '<a href="javascript:void(0)">'. $item['title'] .'</a>';
  }
  else {
    return l($item['title'], $link_item['path'], !empty($item['description']) ? array('title' => $item['description']) : array(), isset($item['query']) ? $item['query'] : NULL);
  }
}

Basically, i'm using this in a theme function override right now so that I can put "<none>" in a menu item's "Path:" box, which generates href="javascript:void(0)" for that menu items link.

Thanks,
Nate

Comments

add1sun’s picture

I am not inclined to add this the Nice menus module as it really is more of a theme decision and not really specific to Nice menus. The "none" behavior would make more sense in a theme override so it could be used in any menu on a site that wanted this feature and not just Nice menus. I'm also not a fan of having Nice menus introduce Javascript beyond the minimal necessary to make the flyout CSS work.

I think it would make more sense to add this as an option to the handbook page that exists on the topic (http://drupal.org/node/143322) and then link to that as a tip from the Nice menus handbook page so anyone interested in it can implement it themselves.

nschindler’s picture

Fair enough.
I'm unfamiliar with the method of getting content added to handbooks here. Is it better to add it as a child page, or a comment?

Thanks,
Nate

add1sun’s picture

Title: Link parent menu item to nothing » Link parent menu item to nothing documentation
Assigned: Unassigned » add1sun
Category: feature » task

You can add something either way, it really depends on if the information should be included in an existing page or be a new page itself. I would say that this should be added directly to the existing page as an alternate to the <span method they are using.

I am on the docs team though so I can take care of adding this in for you. I've moved this to a task for me to do soon.

nschindler’s picture

That would be great!
The span tag mentioned in the handbook didn't work for me with nice_menus. It's been a while now, but IIRC, the menu simply didn't render properly using span.

Thanks very much for your help.

-Nate

add1sun’s picture

Status: Active » Fixed

oops, finally got to this: http://drupal.org/node/194596.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.