I'm using this module in conjunction with Special Menu Items, to create menu items that aren't links, just headers. The Menu Block module preserves their no-link status, but once they reach Accordion Menu, they get translated to active links that of course take you to a "Page Not Found".

Could you please add a feature to make Accordion Menu play nice with "nolink" menu items?

Similar issues in the Superfish module can be found here: #1190688: Superfish not compatible with Void Menu - Forces link attributes..

Alternatively, could the configuration options for Accordion Menu include an option to output only the leaf items as real links, so that clicking on any parent item will only expand/collapse its children instead of also redirecting to a page?

Many thanks,
Tal

CommentFileSizeAuthor
#3 accordion_menu.zip3.26 KBvalante

Comments

valante’s picture

Here's what I have so far, inspired by the Superfish solution:

Delete the following line (202):

$link = l($data['link']['link_title'], $data['link']['href']);

And instead add these lines:

    if ($data['link']['link_path'] == '<nolink>') {
      $output .= '<' . $header . ' class="' . $class . ' nolink">' . '<a name="' . $data['link']['title'] . '">' . $data['link']['title'] . '</a></' . $header . '>';
    } else {
      $output .= '<' . $header . ' class="' . $class . '">' . l($data['link']['link_title'], $data['link']['href']) . '</' . $header . '>';
    }

This works to create name-only a tags in the headers if they're marked as nolink.

solotandem’s picture

Thanks for the code snippet. I agree with the suggestion and also wish core would support the no-link menu item.

valante’s picture

StatusFileSize
new3.26 KB

Oh yes, core supporting no-link would be paradise :-)

So, I've been doing some more thinking about Accordion Menu.

I think it's reasonable to allow that top items will not be links, whether they have a path or not. When I click on an expanding section in a menu, I expect the menu to expand without taking me to another page. Giving that configuration option seems like a good idea.

I'm attaching my solution, which includes a per-block configuration option (in addition to the individual no-link support). Sorry it's not a patch, I suck at creating those. You get a zipped module file instead. Hope you find it useful.

Best,
Tal

skaught’s picture

just reporting: this branch worked for me [#3]. from master 7.x-1.x-dev (2011-Aug-26)

cheers.

solotandem’s picture

Assigned: Unassigned » solotandem
Status: Active » Fixed

Implemented a setting for no link on header menu item in this commit.

This is not integration with the Special Menu Items module, but provides the "no link" feature which is what you requested in the summary. I am considering full integration with SMI. Let me know if you use the separator item.

Please grab the latest dev release (created after this comment) or commit to 7.x branch, test, and report back.

Status: Fixed » Closed (fixed)

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