Hello,
thanks for great module. I've been looking for it for long time.
I just found out that the module strips out menu attributes added throug menu administration. For example I have a menu link "/contacts#firstdivision" with title attribute "First division contacts details", but in the megamenu i got only /contacts. The URL fragment and title are lost somewhere.
Am I doing something wrong? Or its a missing feature (existing bug) in the module?

Comments

paulbarrett79’s picture

+1

I really need this to work here, module should not strip out anchors.

paulbarrett79’s picture

Version: 7.x-1.0-alpha4 » 7.x-1.0-beta2
tuyre’s picture

Thanks also for a great module. Your work really appreciated!

However... I have a problem which I think is related.

I use the TB Sirate Starter theme on a site, which uses TB Megamenu. I also have a main menu item with an external link attribute set, using the Menu Attributes Module. The attribute in question happens to be a target=_blank attribute. It works fine on other sites not using TB Megamenu, or when I disable TB Megamenu on the site in question.

The theme and menu are great... but I believe this issue seriously needs attention please. Menus, as mentioned above, should not have attributes stripped in this way. Not sure if this was intentional, or just needed it bringing to the attention of the themebrain coders?

From searching around, I understand that there is another menu system, Nice Menu, which has a similar problem. Maybe the patch mentioned on this issue page for that [#906130] may give someone a clue to how to apply a similar patch to Nice Menus. [just a guess/shot in the dark]

Link: Nice Menu's Patch page to maybe give someone a clue to fix TB MegaMenu's attributes stripping issue.

diogogomes77’s picture

StatusFileSize
new922 bytes

I had the same problem and made a litle patch to solve it.

Just patch -p1<tb_megamenu_templates_target_fix.patch in the templates folder.

(it's my first patch, hope it goes well)

benjf’s picture

Status: Active » Reviewed & tested by the community

works great, thanks!

alejanic’s picture

I had the same problem and made a litle patch to solve it.

Just patch -p1

(it's my first patch, hope it goes well)

microshift, do you think this would work with my problem? I have a module called Special Menu Items. It adds css attributes 'nolink' and 'separator'

Specifically all I want to do is have unclickable menu items, so basically "header" items for a group of links. Exactly how it's done here with TBMegaMenu - http://www.psychnurse.co.uk/

Under "For Professionals" The three columns have 3 "headers" that are not links. If I apply the class it will show up as not being a link in the Drupal Menu Link section, but as soon as you load the site it's still active with all the normal css, it's just a link that doesn't go anywhere.

Thank you!

marcoscano’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new956 bytes

patch in #4 works for anchors, but not for urls with queries
attached patch to print the link also with the query arguments

please test

marcoscano’s picture

Category: feature » bug
khiminrm’s picture

#7 works for me too. Thanks!!!

hwasem’s picture

I applied #7 and still missing the title attribute. I flushed cache and still not luck.

I want to make sure I'm looking at the same thing you are. When I hover over my menu items, there is no title attribute (text popping up the menu description field).

hwasem’s picture

Issue summary: View changes
StatusFileSize
new1.12 KB

I made the addition of the title attributes in this patch. This is my first attempt at a patch, so please let me know if there is a problem.

I hope this helps,
Heidi

marcoscano’s picture

Good one, the "title" was also missing. Patch #11 is working for me, but it changes mod of the file. Re-created modifications without changing file permissions, patch attached.

hwasem’s picture

Thanks for catching the permission change.

谢艳’s picture

I try to menu attributes, but no effect, and then I used the menu HTML, it works,but i think this is not the best solution…… I tried #7,now,it works for me……

greggmarshall’s picture

While the patch in #12 works, I have two questions.

  1. Why is the link being assembled in the template via PHP versus in the pre-process function?
  2. Is there some reason not to use the theme_link, or theme('link'...), functions to assemble the link rather than assembling it in pieces?

I did notice that even with #12, the "fragment" attribute is not being incorporated into the generated link.

hwasem’s picture

These are good questions, greggmarshall. I have very limited knowledge of PHP and the changes in the template was something I could grab onto and fix for my purposes. So I did. That's about all I can say.

For what it's worth, I do know that using the module Menu Attributes had no impact on my ability to have attributes show up in megamenu, so something in the module must be stripping or not adding via pre-process. I wasn't using Menu Attributes specifically for my mega menu, I just noticed it didn't add anything when I was using it for a mobile version of the same source menu.

emudojo’s picture

#12 works wonders, thanks!

SimonMartineau’s picture

Patch #7 works for me for the destination attribute.

Thanks!

drupalycious’s picture

Hello,

I tried the patch 12 but with no success, so I wrote another issue, but both might be related.
You can check it here https://drupal.org/node/2229665

marko b’s picture

For me this patch didn't help as $a_classes is empty

What I did is check the $item['link']['localized_options']['attributes']['class'] variable and got the classes from default menu settings and then added them in this part and got classes I previously set. This way I managed to make modal forms also work with this module.

  <a href="<?php print in_array($item['link']['href'], array('<nolink>')) ? "#" : url($item['link']['href']);?>"
   class="<?php print implode(" ", $item['link']['localized_options']['attributes']['class']);?>">
DrupalPiet’s picture

Patch No.12 seams to work for us.
Problem was an URL like "node/87?qt-car_tabs=0"
Which in Drupal was shown as "nice-alias?qt-car_tabs=0"
but in TB Megamenu, just "nice-alias".

With this working no.12 patch "nice-alias?qt-car_tabs=0"

Thank you, Pieter

marko b’s picture

Most patches use

class="<?php print implode(" ", $a_classes);?>"

for class definition, problem is that $a_classes is usually empty for some reason so that doesn't work.

I use this instead

class="<?php print implode(" ", $item['link']['options']['attributes']['class']);?>">

billy_comic’s picture

StatusFileSize
new26.08 KB
new28.17 KB
new29.5 KB
new75.3 KB

I've had to use absolute URLs to link to query views. My problem is I assign columns and links to those columns (ex 2 columns with 4 links in each). I save, then load the site and the dropdown displays wrong links in columns. (ex. 2 Columns. One with 6 links, the other with 2). No matter how many times I try, it messes it up different with each save. Very buggy. Client is already committed to this Navigation and now it is causing issues.

Makes menu almost unusable.

See attachments

edodusi’s picture

I can confirm that the patch in #12 works. It should be committed.

hwasem’s picture

Status: Needs review » Reviewed & tested by the community

Updating status.

hwasem’s picture

billy_comic, I think you are having a different problem. This issue is about metadata on links (titles displaying on hover and attributes being stripped), not the display of links in TB Megamenu. You should open a new issue.

webadpro’s picture

I'm a bit like greggmarshall here. Why isn't this using drupal_attributes and settings all its attributes in the preprocess function?

I think the way its being added at the moment will simply reduce the link's flexibility from other modules to merge in.

webadpro’s picture

StatusFileSize
new2.26 KB

If anyone could test the patch also, this would provide us with full flexibility of the link as for the attributes.

webadpro’s picture

StatusFileSize
new2.28 KB

Sorry guys,

Please review this patch, I had forgot the link options.

Cheers.

dstopa’s picture

The latest patch works well. It's using the Menu attributes now, Thanks!

webadpro’s picture

It sure is. Well its using any attributes assigned to the menu item. This allow other module to add attributes to the item, such as Menu attributes.

Anonymous’s picture

Thanks for the patch #29. Works thanks

michaelngodh’s picture

StatusFileSize
new841 bytes

Thanks for your patches. We Reviewed and tested for the patch #11. It's so great. Worked

I implemented the patch to add the title attribute into menu-item. Review it.

And we solved this problems for multi languages. We will release beta6 version soon.

Thanks for all

michaelngodh’s picture

Status: Reviewed & tested by the community » Needs review
hwasem’s picture

When I apply the patch in #33 to the dev dated Janyuary 8, I get a White screen. The error in dblog is:
Notice: Undefined variable: link_attributes in template_preprocess_tb_megamenu_item() (line 134 of /var/www/upgraded7/sites/all/modules/tb_megamenu/tb_megamenu.themes.inc).

I have also tried the newest dev dated 1/12 and get a similar error with title:
Notice: Undefined index: title in template_preprocess_tb_megamenu_item() (line 137 of /var/www/upgraded7/sites/all/modules/tb_megamenu/tb_megamenu.themes.inc).

I applied patch #29 (to dev dated January 8) and it works without error. My menu attributes are showing attributes and titles.

michaelngodh’s picture

Status: Needs review » Closed (fixed)

Hi hwasem,

Trying update version the latest dev (Jan 16). We fixed and tested it. It's run well.

hwasem’s picture

I'm not sure what's going on, but I still get the same error as 1/12 dev on the latest dev dated 1/19/15:
Notice: Undefined index: title in template_preprocess_tb_megamenu_item() (line 137 of path_to_site/sites/all/modules/tb_megamenu/tb_megamenu.themes.inc).

Also getting a Chosen module dependency error on the newest version. Is Chosen module required? I thought it was removed some time ago.

Thanks,
Heidi

cabplan’s picture

So these patches did work but my question is why didn't the project manager of this module include these updates in the Aug 2013 updates, so it is global

kingfisher64’s picture

1/3/2015

Notice: Undefined index: title in template_preprocess_tb_megamenu_item() (line 137 of sites/all/modules/tb_megamenu/tb_megamenu.themes.inc).

7.x-1.0-beta5+16-dev (21st Jan 2015)

Like hwasem said on #137 can the project manager commit the previous patches to solve this?

Many thanks

Edit: going back to the older stable version removes this error. So not sure why the fix hasn't been applied to the latest dev.

hwasem’s picture

Status: Closed (fixed) » Needs work

I just realized this issue is closed and I don't think it should be. Changing status to Needs Work. Sorry if that is not the correct status, I just don't think it is closed based on latest dev 1/21/15.

It is requiring Chosen. And this error is still present after installation:

Notice: Undefined index: title in template_preprocess_tb_megamenu_item() (line 137 of /var/www/upgraded7/sites/all/modules/tb_megamenu/tb_megamenu.themes.inc).

michaelngodh’s picture

Hi @hwasem,

TB Mega Menu requires chosen module. Yesterday i downloaded the latest version and i tested TB Mega Menu on the latest verion of Drupal. And it's fine, i can't see any errors from it.

But to make anything is well, i tried to fix it again. Now you can download it from the latest dev version (2015-Mar-04).

Thanks all. If have any issues, please let me know.

michaelngodh’s picture

Version: 7.x-1.0-beta2 » 7.x-1.x-dev
Status: Needs work » Needs review
michaelngodh’s picture

Status: Needs review » Fixed
hwasem’s picture

No more error. Thanks, michaelngodh!

michaelngodh’s picture

Status: Fixed » Closed (fixed)

No problem

kingfisher64’s picture

Indeed thankyou michael for your effort - it is appreciated :)

patel prem’s picture

Thanks marcoscano !

Below patch work for me.

https://www.drupal.org/files/tb_megamenu_templates_target_fix.patch