I seem to have difficulties to make Menu firstchild and Superfish work together.

I have a very simple Main menu that is as follows :
-Home
-Workshop
--Presentation
--Styles
-Contact
When I display the menu block normally, everything works fine and the item "Workshop" actually points to the first-child element, "Presentation".
But when I try to use this menu with Superfish, the link becomes "example.com/"
Thanks in advance for your help.

Comments

jon betts’s picture

Part of the original message from the post above is missing due to code stripping. What it should say is:

But when I try to use this menu with Superfish, the link becomes "example.com/<firstchild>"

It would be great if this module either supported the firstchild module or included the feature natively.

bryancasler’s picture

subscribe

Jiri Volf’s picture

subscribing

Poieo’s picture

Confirm the same issue. Subscribing.

striknin’s picture

Subscribing ! Same issue for me too.

Lithops’s picture

Hi,
Same issue here, really nobody?

jasondecamp’s picture

subscribing

sboots’s picture

Subscribing! Same issue.

Fonkel’s picture

Would be great to have an option for a false return on click for parent menu-items. I prefer this over using menu-firstchild

omercioglu’s picture

Perhaps it can support "" (
, , ... whatever) natively.

omercioglu’s picture

Sorry, posting again;
Perhaps it can support "<none>" (<parent>,<firstchild>,<separator>, ... whatever) natively.

omercioglu’s picture

sboots’s picture

Hey everyone! Here's a small fix to get working with Superfish menus. It should still work even if menu_firstchild is disabled, but i haven't checked yet. Feedback welcome. : )

In superfish.module, line 1012 is:

      $output['content'] .= l($menu_item['link']['title'], $menu_item['link']['link_path'], $link_options);

Immediately above that line, paste in:

      if($menu_item['link']['link_path'] == '<firstchild>' && function_exists('_menu_firstchild_get_firstchild_href')) {
        $menu_item['link']['link_path'] = _menu_firstchild_get_firstchild_href($menu_item['link']['mlid']);
      }

That calls menu_firstchild's internal function to find the child link URL to use, and then the l() function on the line below takes care of finding aliases/etc. which is pretty cool. : ) Drupal... Powerful but confusing!

(And, a hat tip to the Devel module and its dsm() function, which came in super handy while trying to figure this out!)

Have an awesome day!

Poieo’s picture

@sboots - Works for me. Not sure if there are negative effects. Thanks a ton!

mac_weber’s picture

Status: Active » Closed (duplicate)

I don't think #13 is the best approach, is it cares about a specific module. Actually void_menu also has this issue.
This thread should be marked as duplicate:
#1190688: Superfish not compatible with Void Menu - Forces link attributes.

inky@inky3d.com’s picture

I don't suppose you could include a patch for the 6.x-1.8 version of Superfish?

I'm having the same issue there :/

mehrpadin’s picture

Here's a quick fix: superfish.module (D7) , line #1012 :

$output['content'] .= l($menu_item['link']['title'], $menu_item['link']['link_path'], $link_options);

Change it to:

$output['content'] .= l($menu_item['link']['title'], $menu_item['link']['href'], $link_options);

To Floris: There's actually already such a thing, it's called as sf-Touchscreen (Block configuration, under Plugins); The first click on a parent item returns false - and shows the sub-menu as a result - and the second click on the same parent item will be considered a normal click.

To Sean: Not recommended, but thank you and I truly and honestly appreciate it!

To Ingrid: Are you talking about the Void menu? because as far as I see 6.x-1.8 works with the Menu Firstchild.

Thanks everyone! :)

Update: Fixed as of v1.9-beta3.

anavarre’s picture

The solution provided in #17 worked fine for me.

mehrpadin’s picture

Bonjour Aurelien,

Just upgrade to v1.9-beta4 :)

dieppon’s picture

#17 works like magic, thanks

nicolas bouteille’s picture

+1