Blog

Drupal 7 Module: Void Menu

This project has a dedicated page in the downloads section… Go There Now

There are a couple existing modules that alter the menu stack for you in their own special way, but they add additional time onto your projects because not only do you have to style menus for your existing links, but you also have to style for non-links wrapped in span tags. Or the module just forces the parent to link to the first child.

These module have their purposes, but what if you just want a simple module to make a link an actual link? What if you just wanted to link to “javascript: void(0);” or “#”. Nothing really exists for this right? Not without writing some lengthy alters all up in your function files.

I for one wasn’t digging it, so I came up with this little module (inspired by special menu items and menu firstchild).

The idea is simple, provide a new tag for users when creating menus that will simply wrap the title in a valid <a> tag.

My Link
or
My Link

The possibilities are limitless because you can specify what value you want to insert into the href tag in the module options. So you can use it to call that js function you want to invoke from the menu.

My Link

I hope you enjoy it, gimme some feedback and I will make improvements as I get time.

Posted in: Drupal

Leave a Comment (4) →

4 Comments

  1. Ralf Bünemann May 10, 2011

    I was desperately seeking for a quick and simple solution to integrate a print-javascript into a menu link (without newbie-horrors like hooking etc.). This one did it! So simple, so flexible, just ingenious stuff! Many thanks from Germany for that!

    reply
    • Will May 18, 2011

      Glad you found it useful!

      reply
  2. drwierdo May 14, 2011

    Hello mate,
    I too am looking for what this module promises to do. But i dont seem to make it work. Here is what i did:

    1. Downloaded and extracted the module in the sites/all/modules and then enabled it
    2. I go to the main menu list, and when i open one of the links, underneath the path there is a description which says that now i can use the option to make my menu item unlinkabe.
    3. So in the path field i write
    4. I go back to main page and try to clik on the link, and it turns out “403 Forbidden

    You don’t have permission to access /final/javascript: void(0); on this server.”
    5. Then what i do is i again go back and in place of the i write
    6. I again go back and then click on the link, now it turns out 404 error.
    7. So I flush out all the cache, as the last resort, and still no luck….

    what have i done?? I am using mega menu…hope there is no conflict with the megamenu??

    Please man i want this to work for me, like it has done for so many others…plz

    reply
    • Will May 18, 2011

      Thanks for using the module! The issue actually exists in megamenu. I have provided a patch in their issue tracker.

      reply

Leave a Reply