void-menu-icon.png

Summary

Void menu allows you to configure special values to tags for use in the Drupal 7 menu system. You can customize up to 10 different void tags with any value you wish and use them freely inside the Drupal menu system.

The why

Several excellent modules exist already that may be more suitable for your needs including special_menu_items (http://drupal.org/project/special_menu_items) and menu_firstchild (http://drupal.org/project/menu_firstchild).

Both of these modules are excellent at what they intend to accomplish, however both are very limiting in what they can do. Void Menu seeks to satisfy a gap that exists in these modules, and inherently in the Drupal menu system itself.

Void Menu allows you to set custom href attributes for your menu items, which unlocks the potential to (among other things) invoke JavaScript functions from your menus.

An example

Let's say you have created a custom JavaScript function that will set or check a cookie for a user and then send them to a specified location or apply a new condition to the page based on that operation. Prior to void menu we needed to add long winded alter functions in order to accomplish this. Now we simply assign javascript: MyCustomFunction(); to one of our void tags, and we can freely use that in any Drupal menu.

There's more

As an added bonus, and because of the functionality of this module, you are also able to use actual anchors as menu items that serve no other purpose than placeholders. This is accomplished with a void tag that is set to javascript: void(0); or even a simple hash tag #. The benefit to using this module over special_menu_items for this is that your menus will not require any additional styling to account for the added span tags used by special_menu_items, and will be W3C valid because every anchor must have an href attribute.

Security

This module allows users to enter javascript and hook it into the Drupal menu system. Any user with "Administer Site Configuration" will have access to this module, and many others that could prove harmful if a malicious user was given free reign over your web site. Always verify which users you are granting access to Administer your site.

Drupal 8.x

At this time it is hard to say whether development of this module will need to continue for D8.

If core development, or security concerns raise a need for a module to invoke javascript functions from menu items - I will continue development to meet that need. Thankfully, based on what we do know - the use of this module in D8 for basic anchor tags will no longer be necessary.

Project Information

Downloads