Not sure if that has been covered previously but based on this discussion: http://drupal.org/node/143322

Would it be possible to add something like the following to megamenu.module (line 206).

        if ($twig['link']['link_path'] == "http://no.link") {
            $output .= '        <h3 class="megamenu-slot-title"><span class="nolink">'.t($twig['link']['link_title']).'</span></h3>'."\n";
        } else {
            $output .= '        <h3 class="megamenu-slot-title">'.l($twig['link']['link_title'], $twig['link']['link_path']).'</h3>'."\n";
        }

This would ONLY allow column titles to be added to the top of the menu which are not links.

CommentFileSizeAuthor
#10 megamenu-2.x-dev.nolinks_865892.patch974 bytesAnonymous (not verified)
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Anonymous’s picture

Eventually we'd like to build an interface to enable one to check off menu items that should be rendered as plain text.

aschiwi’s picture

Are you also planning to enable _anything_ to go in there? I've seen login forms and even videos in mega menus.

Anonymous’s picture

Yes, the next phase of this module will be to allow the insertion of blocks into a mega menu.

erykmynn’s picture

There is an available module that lets you put non-link items into a drupal menu. has anyone tested for compatibility. could be a non-code solution. (or a quick compatibility fix)

Stacy Prendeville’s picture

Anyonet tested special menu module with the mega drop down?
FYI special menu module has a bug that does not work primary links at the moment, so anyone who does test it, make sure you don't do it on that nav.
Be interested to hear if anyone got that working

Stacy Prendeville’s picture

FYI - Special Menu Module does not work with Mega Menu

Stacy Prendeville’s picture

Sittard -
Is it possible you could explain exactly where to add this code, I have added this line 206 but now these parent items that I want to be "nolink" are duplicated for every entry as well as being still a link?
do I need to delete anything alongside?
thanks

sittard’s picture

I suspect the development branch of this code has moved forward since this original post. Technically it should be possible to patch the most recent release with the code above. But I'm not able to help you with that.

Or alternatively you could wait until the admin interface is complete see post FilmKnurd's (#1) above.

craspouille’s picture

Hi FilmKnurd!

Will you be able to put this "an interface to enable one to check off menu items that should be rendered as plain text" in the next release?

Best regards,

Anonymous’s picture

Status: Active » Needs review
FileSize
974 bytes

I've created a patch against 2.x-dev that integrates this module with Special Menu Items. Items with paths "nolink" will render as a span instead of a link.

craspouille’s picture

I am sorry, I am a beginner, I do not understand everything :-)
So first, I have to download Special Menu items, and then, to paste the patch somewhere ? But where exactly?
And do I have to put the name of my theme here instead of "theme" ? megamenu_theme_menu_tree
sorry again :-)

Anonymous’s picture

1. Download and install special_menu_items
2. Make menu items non-links by putting, "nolink" for the path
3. Install this patch on megamenu

Part 3 is the hard part if you have never worked with patches before. Basically, replace line 219 of megamenu.module with the following:

 'data'  => $link_data,

And insert the following at line 215:

 if ($leaf['link']['router_path'] == 'nolink') {
     $link_data = '<span>' . $leaf['link']['link_title'] . '</span>';
 }
 else {
     $link_data = l($leaf['link']['link_title'], $leaf['link']['href'], $leaf_link_options);
 }

This isn't a perfect patch. I need to expand it so that all items can be non-linkable and I don't like baking in the HMTL, so I'd like to push it off to a theme function. But you can see how the technique works anyway.

craspouille’s picture

Thanks for your prompt answer, as usual!!!

Anonymous’s picture

Status: Needs review » Fixed

Committed patch to integrate this module with special_menu_items in #497484

mikeaja’s picture

I just want to add that I wouldn't recommend the Special Menu Items module. As far as I can see, it re-writes all menu links, for every menu in Drupal (including all admin ones). This seems like massive overkill, and will surely cause conflicts with other modules.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

batigolix’s picture

the solution in #12 does not take care of the links in the highest level items of the megamenu menu trees, the so called megamenu-parent-title ...

this is the code at line 285 of megamenu.module

    $branch_items[] = array(
    	'id' => 'megamenu-mlid-'.$branch['link']['mlid'],
    	'class' => 'megamenu-parent ' . 'megamenu-parent-' . $t1_count_attributes . $active,
    	'data' =>  '<h2 class="megamenu-parent-title">' . 
                   l(_megamenu_get_translated_menu_title($menu_name, $branch['link']['mlid']), 
                         $branch['link']['href'], $branch_link_options) . 
                   '</h2>' .$twig_items_list
    );

I changed it to:

    $linkname = _megamenu_get_translated_menu_title($menu_name, $branch['link']['mlid']);
    $branch_items[] = array(
    	'id' => 'megamenu-mlid-'.$branch['link']['mlid'],
    	'class' => 'megamenu-parent ' . 'megamenu-parent-' . $t1_count_attributes . $active,
    	'data' =>  '<h2 class="megamenu-parent-title">' . 
                   ($branch['link']['router_path'] == 'nolink' ? '<span class="nolink">'. $linkname. '</span>' : l($linkname, 
                         $branch['link']['href'], $branch_link_options)). 
                   '</h2>' .$twig_items_list
    );

Now also the parent items are displayed without link when the router path is "nolink"

egulias’s picture

#17 patch for highest level links worked for me.
Might this be a new feature request?

Regards.

egulias’s picture

Hi all!
If you are using jquery.drilldown plugin together with megamen, there is a small bug in IE.
In line 85 of this script they solve a bug (another one) for jQuery 1.2 $().clone function. As the patch for megamenu highger level nolink-menus adds an span tag for the no link, the script brokes with an error.
Simply remove the span from the patch and add the "nolink" class to the a tag.

Regards.

drwierdo’s picture

I think megamenu also doesnot allow the "void menu" module to implement its js. When i use void menu and then set the path of the menu item to <void> the page returns 404 error...but when i switch over to drupal classic menu, the link is not rendered...

What does this mean???

chrispooh’s picture

Super solution! Thank You!

alexbk66-’s picture

Anonymous’s picture

Status: Closed (fixed) » Needs review