/ Published in: PHP
The following code lets us designate "menu links" that will not actually link anywhere.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php function phptemplate_menu_item_link($item, $link_item) { if ($item['path'] == '<none>') { $attributes['title'] = $link['description']; // Here you can specify a '#' link or wathever you want: // return '<a'. drupal_attributes($attributes) . 'href="#">'. $item['title'] .'</a>'; return '<span'. drupal_attributes($attributes) .'>'. $item['title'] .'</span>'; } else { } } ?> <?php /* * As a nice extra, we can also add additional help text to the menu item edit page. For that * you will need to implement a very small module that implements form_alter. * The module itself doesn't need anything more than the following code snippet: */ function example_form_alter($form_id, &$form) { if ('menu_edit_item_form' == $form_id) { $form['path']['#description'] .= ' ' . t('Enter %none to have a menu item that generates no link.', array('%none' => '<none>')); } } ?>
URL: http://drupal.org/node/143322