Closed (fixed)
Project:
The Better Mega Menu
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Jul 2013 at 16:36 UTC
Updated:
20 Nov 2015 at 07:23 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
paulbarrett79 commented+1
I really need this to work here, module should not strip out anchors.
Comment #2
paulbarrett79 commentedComment #3
tuyre commentedThanks 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.
Comment #4
diogogomes77 commentedI had the same problem and made a litle patch to solve it.
Just
patch -p1<tb_megamenu_templates_target_fix.patchin the templates folder.(it's my first patch, hope it goes well)
Comment #5
benjf commentedworks great, thanks!
Comment #6
alejanic commentedmicroshift, 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!
Comment #7
marcoscanopatch in #4 works for anchors, but not for urls with queries
attached patch to print the link also with the query arguments
please test
Comment #8
marcoscanoComment #9
khiminrm commented#7 works for me too. Thanks!!!
Comment #10
hwasem commentedI 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).
Comment #11
hwasem commentedI 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
Comment #12
marcoscanoGood 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.
Comment #13
hwasem commentedThanks for catching the permission change.
Comment #14
谢艳 commentedI 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……
Comment #15
greggmarshallWhile the patch in #12 works, I have two questions.
I did notice that even with #12, the "fragment" attribute is not being incorporated into the generated link.
Comment #16
hwasem commentedThese 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.
Comment #17
emudojo commented#12 works wonders, thanks!
Comment #18
SimonMartineau commentedPatch #7 works for me for the destination attribute.
Thanks!
Comment #19
drupalycious commentedHello,
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
Comment #20
marko b commentedFor 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.
Comment #21
DrupalPiet commentedPatch 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
Comment #22
marko b commentedMost 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']);?>">Comment #23
billy_comic commentedI'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
Comment #24
edodusi commentedI can confirm that the patch in #12 works. It should be committed.
Comment #25
hwasem commentedUpdating status.
Comment #26
hwasem commentedbilly_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.
Comment #27
webadpro commentedI'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.
Comment #28
webadpro commentedIf anyone could test the patch also, this would provide us with full flexibility of the link as for the attributes.
Comment #29
webadpro commentedSorry guys,
Please review this patch, I had forgot the link options.
Cheers.
Comment #30
dstopa commentedThe latest patch works well. It's using the Menu attributes now, Thanks!
Comment #31
webadpro commentedIt 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.
Comment #32
Anonymous (not verified) commentedThanks for the patch #29. Works thanks
Comment #33
michaelngodh commentedThanks 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
Comment #34
michaelngodh commentedComment #35
hwasem commentedWhen 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.
Comment #36
michaelngodh commentedHi hwasem,
Trying update version the latest dev (Jan 16). We fixed and tested it. It's run well.
Comment #37
hwasem commentedI'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
Comment #38
cabplan commentedSo 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
Comment #39
kingfisher64 commented1/3/2015
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.
Comment #40
hwasem commentedI 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:
Comment #41
michaelngodh commentedHi @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.
Comment #42
michaelngodh commentedComment #43
michaelngodh commentedComment #44
hwasem commentedNo more error. Thanks, michaelngodh!
Comment #45
michaelngodh commentedNo problem
Comment #46
kingfisher64 commentedIndeed thankyou michael for your effort - it is appreciated :)
Comment #47
patel prem commentedThanks marcoscano !
Below patch work for me.
https://www.drupal.org/files/tb_megamenu_templates_target_fix.patch