I have a multi language site with language selected by URL. When I create a void menu it looks to be working fine on the administration interface, the link shown on mouse over is correct. However on the front page the menu link points to http://www.example.com/pt-br/%3Cvoid%3E (http://www.example.com/pt-br/<void>)

If someone clicks on the link he/she will get drupal's 404 error.

Comments

WillHall’s picture

Are you by chance using nice_menus or some other menu modules?

mac_weber’s picture

I have superfish module on that menu

WillHall’s picture

Bad behavior in superfish module - overwriting localized_options array.

Try opening superfish.module and change at line 1005

From
$link_options['attributes'] = $menu_item['link']['localized_options']['attributes'];

To:
$link_options['attributes'] += $menu_item['link']['localized_options']['attributes'];

Let me know if that helps. Btw, it seems all of the menu modules do this and need to be fixed. tsk tsk.

mac_weber’s picture

I get error 500 if I do this change

mac_weber’s picture

more details about the error from apache's error log:
mod_fcgid: stderr: PHP Fatal error: Unsupported operand types in /var/www/drupal-7/sites/all/modules/superfish/superfish.module on line 1005

and php version:

$php --version
PHP 5.3.2-1ubuntu4.9 with Suhosin-Patch (cli) (built: May  3 2011 00:45:52)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
WillHall’s picture

Assigned: Unassigned » WillHall

Bummer, that was just a cursory glance. I will have to install the module and check it out.

I'll let ya know what the fix is in a few.

mac_weber’s picture

thanks for helping Will!

WillHall’s picture

Title: void_menu not working on multi-language site with URL detection » Superfish not compatible with Void Menu - Forces link attributes.
Project: Void Menu » Superfish Dropdown Menu
Version: 7.x-1.1 » 7.x-1.8
Assigned: WillHall » Unassigned
Priority: Major » Normal

There was a typo in my original..

Should have been:
$link_options+= $menu_item['link']['localized_options'];

However, even that doesn't seem to help.

I am going to move this over to the superfish issue queue - they are going to be more familiar with their module.

In the long run, superfish is simply overriding the items stack. The same issue existed in similar modules like nice_menus, and was solved here: http://drupal.org/files/issues/nice_menus.module_6.patch

mac_weber’s picture

I tried using my own javascript or Drupal.behavior to "fix" it.


(function($) {
  Drupal.behaviors.noClick = {
    attach: function(context, settings) {
      $('a[href*="%3Cvoid%3E"]').unbind('click');
      $('a[href*="%3Cvoid%3E"]').bind('click', function(e) {
        e.preventDefault();
        return false;
      });
    }
  }
})(jQuery);

This script searches for links ending with the string <void> and disable the clicks. I realized that if I click twice it would follow the link. Then I disabled the sf-touchscreen plugin so, this script worked. It is possible also to mark the option to use sf-touchscreen (superfish block options) to be used only on browsers that need it.

This is far from the best solution, but made my website usable for now.

WillHall’s picture

omercioglu’s picture

Sub

skolesnyk’s picture

Please, fix the issue. It's been bugging me for two weeks as neither Menu First Child or Special Menu Items work on superfish menus

omercioglu’s picture

Change this line in superfish.module from
$output['content'] .= l($menu_item['link']['title'], $menu_item['link']['link_path'], $link_options);
to
$output['content'] .= l($menu_item['link']['title'], $menu_item['link']['href'], $link_options);
I don't think this small change needs a seperate patch.

skolesnyk’s picture

Should this fix work with Special menu items module and its placeholders?

Edit 1: still have "< nolink >" in the menu item link instead of '#'
Edit 2: installed Void Menu, placed '< void1 >' in the link for a menu item. It produces a link like http://www.website.com/%23, instead of just '#'.

omercioglu’s picture

This fix is only for d7-Superfish.
From what i can see, "Special menu items" is for d6-only right now, most probably this won't work for it.
This is how it works for me.
1-ReSave the menu/menu items where you would like to have "#".
2-Clear your cache.
Are you using d6 by the way?

skolesnyk’s picture

I'm using D7 port of Special menu items https://github.com/webflo/special_menu_items

skolesnyk’s picture

I did put in the menu item, saved it, cleared cache, yet the link is still www.site.com/#

Does combination of the Superfish fix you suggested and Void Menu < void > link works in your case?

omercioglu’s picture

Yes, it's working perfectly. Problem is, "Void menu" modifies the "href" attribute of the menu item, but Superfish uses "link_path" to output the menu items. I'm using it on the university site http://etu.edu.tr where you can see superfish and void menu working together...

omercioglu’s picture

www.site.com/# is the expected output, this means it's working correctly :-). <void1> = # . I did not tested <void>, but you can use void1 anyway.

skolesnyk’s picture

Yep, I see it's working on your site. Do you know why in the I have < a href="/uk/%23" > instead of < a href=/uk/# > . Link in FF is display correctly with # .

omercioglu’s picture

Do you get href="/uk/%23" with "special menu items" or "void menu"?

omercioglu’s picture

I've found the solution, i had overlooked someting i added sometime ago...
Add this:

      $link_options+= $menu_item['link']['localized_options'];      

under the line:

      $link_options['attributes'] = array('class' => array_filter($link_class));
skolesnyk’s picture

Well, it's a bit messed in the code.

What I had was

line 1003:
      $menu_item['link']['localized_options']['attributes']['class'] = $link_class;
 
      $link_options['attributes'] = $menu_item['link']['localized_options']['attributes'];
      //$link_options+= $menu_item['link']['localized_options'];

changed to

$link_options['attributes'] = array('class' => array_filter($link_class));
$link_options+= $menu_item['link']['localized_options'];    

Works like a charm. Thanks a million, omercioglu! I think you still should release a new version of Superfish, as bug is, thought not major, breaks important functionality.

Edit: < front > doesn't work now! Displayed as is.

flacoman91’s picture

thanks skolesnyk and omercioglu
Void Menu and the changes listed works. I was trying to figure this out for a while.

nixar’s picture

I just created an account to thank you guys for the solution.

geek-merlin’s picture

for special_menu_items.module:
i created an issue which might provide a fix - your opinion?
#1221294: option to use <a href="#"> for "nolink" items to not break other modules

stldrupal’s picture

Here is a hacked up crude javascript that might work. Replace the CLASSFORMENU with the class on the top nav. Try sf-depth-1.

====================

function handleKeyPress(evt) {
if (!evt) evt = window.event;
var el = (evt.srcElement) ? evt.srcElement : (evt.target) ? evt.target : null;
if (el){
var searchclassName = el.className;
var t = searchclassName.search("CLASSFORMENU");
if (t==0){
return false;
}
}
}
document.onclick= handleKeyPress

giorgosk’s picture

following suggestions in #13 #22 and #23 I created this patch which seem to work
please test and report

giorgosk’s picture

Status: Active » Needs review

needs review

mac_weber’s picture

@maintainers, please do a git push to QA. Thus the patches can be tested there.
@GiorgosK the patch name should be this format:

giorgosk’s picture

did not know there is a patch naming proposal thanks

mehrpadin’s picture

Hey there,

Next version coming in the next few days. :)

Giorgos, thanks for your helps!

mac_weber’s picture

@GiorgosK I like this guide Advanced patch contributor guide

mehrpadin’s picture

Status: Needs review » Fixed

Fixed as of v1.9-beta3 :) thank you all.

mac_weber’s picture

is it also fixed for D7? - I did not test it

giorgosk’s picture

@Mac_Weber
this issue is for drupal 7

jaspher’s picture

On my site, this works everywhere BUT the actual menu itself. In admin areas, (List links, etc) and breadcrumbs the links are will point to # and javascript: void(0);. But clicking on links on the menu itself will still bring me to "page not found".

Used 1.8 patched and latest 1.9beta4.

Any suggestions on something I may have missed?

---
EDIT: did not even read the OP carefully. I'll try all the suggestions first and come back...
EDIT 2: This works; sorry.. Mistake on my part!

Status: Fixed » Closed (fixed)

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

colle901’s picture

As reported in the edit to #23, links to <front> are not handled correctly. I am using v1.9-beta4.

skolesnyk’s picture

@colle901, I'm using Supervish Version 1.8 with Voidmenu. Void menu items work fine for me. You can can them out here http://expertise.one2action.com/en

If it doesn't work for you, try http://drupal.org/project/menu_firstchild -- a module with similar functionality but more recently updated and more popular.

webatelier’s picture

Superfish 1.9 beta 4 with Void Menu worked for me using the <void1> option in placeholder menu items
i did NO code changes and no issues with the <front> so far ...

payamspot’s picture

Finally! :)

Confirming #41 (webatelier)

Installed Superfish 1.9 beta4, now "Menu Firstchild" and "Void Menu" modules work properly. ( links to #)

"Special menu items" still not working properly.

macmaci’s picture

This issue queue has been very helpful -- particular for a newbie--however isn't it bad practice to have a menu appear to be a link, by having the "hand" icon appear, then being able to "click" the item and then having it go no where ex. example.com/#? The current solution is greatfully appreciated but will there be a better one in the future. Something similar to the way currently works?
Thanks!

mehrpadin’s picture

Hey there,

Sorry for the late reply, issue is closed and didn't appear in the queue. There is a solution: http://drupal.org/project/special_menu_items

catchmagu’s picture

thanks Mac_Weber for your patch...

vvs’s picture

Hey there,

Sorry for the late reply, issue is closed and didn't appear in the queue. There is a solution: http://drupal.org/project/special_menu_items

and
https://drupal.org/node/1221294#comment-6450416