How to make a Drupal menu item link to itself for use with drop down menu modules.
A problem that I have always ran across when deploying Drupal sites is that there is no "out of the box" functionality that allows you to create a menu item that doesn't link.
A scenario to describe this problem is if you are using a menu module such as Superfish or Nice Menus. Lets say you have a top parent menu item, "Business Services", as shown in the image below:

If you want to have the parent link (Business Services) dead, so that the user can't click on it, thus forcing the user to use the drop down menu, you are out of luck. This isn't possible with the core of Drupal. The path must contain either a path to an internal Drupal node, or an external link.
It seems logical to think that Drupal would allow a menu item to link to itself since we can link to external URL's. The way I used to work around this problem was to have the parent menu item (Business Services) be a page that simply listed the drop down menu items in a bulleted list. I found this redundant and searched for a different method.
I looked into a module, Menu Item Container to allow for this functionality, and also read a blog post about hacking the core includes/menu.inc file to disable the filter that checks the path input.
The Menu Item Container module was not available for Drupal 7 yet, and I did not want to hack Drupal core since it may affect future upgrades.
Since I couldn't have a menu item that didn't link, my next approach was to try to add a token into the path field of the menu item to make it link back to itself. I tried using "[current-page:url]/#" but Drupal rejected it because Tokens are not allowed in the path of menu items. After doing more research I found a module called Menu Token which allows you to use tokens in your path.
After downloading and installing Menu Token, I then added a new menu item called "Business Services". For the path I typed "[current-page:url]/#" and checked the box that says "Use tokens in title and in path.".

I then moved the children items to be underneath the new "Business Services" menu item, and deleted the old "Business Services" node that had the bulleted lists.

The problem was solved.
I feel that Drupal should allow this functionality in the core; either by adopting the Menu Token module or by modifying the includes/menu.inc file. Feel free to leave a comment with your feedback or suggestions. I would love to hear how others have worked around this issue.
About the Author
Add comment
Comments
Doesn't work with D6
Not working?
I cannot reproduce your error
It's an up-to-date install of
If you want to contact me by
Recent comments
Contact Us
The Computer Group
2166 E. Morgan Ave
Evansville, IN 47711
Phone: (812) 402-7720
Fax: (812) 250-4857
Latest Blogs
We Accept

Customer Login
: Customer Billing Portal :
: VOIP Manager :



excellent