Download & Extend

Menu firstchild support

Project:Superfish
Version:7.x-1.8
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (duplicate)

Issue Summary

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

#1

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.

#2

subscribe

#3

subscribing

#4

Confirm the same issue. Subscribing.

#5

Subscribing ! Same issue for me too.

#6

Hi,
Same issue here, really nobody?

#7

subscribing

#8

Subscribing! Same issue.

#9

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

#10

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

#11

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

#12

#13

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!

#14

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

#15

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.

#16

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 :/

#17

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.