Posted By

MikeyLikesIt on 07/01/10


menu drupal

Versions (?)

Who likes this?

2 people have marked this snippet as a favorite


Drupal Menu Items that are not links

 / Published in: PHP


This snippet allows admins to create menu items which do not link anywhere. This is most useful in situations where one wants to have dropdown menus where the parent item should not be a link.

This same method could be used to create non-linking menu divider/headings.

Use for every menu item that should not be linkable.

Also, consider using to provide this capability.

  1. <?php
  2. function THEMENAME_menu_item_link($link) {
  3. if (empty($link['localized_options'])) {
  4. $link['localized_options'] = array();
  5. }
  7. if (!$link['page_callback'] && strpos( $link['href'], '')) {
  8. return '<a href="javascript:void(0)" onclick="return false" class="nolink">'. $link['title'] .'</a>';
  9. }
  10. else {
  11. return l($link['title'], $link['href'], $link['localized_options']);
  12. }
  13. }
  14. ?>

Report this snippet  

You need to login to post a comment.