Closed (fixed)
Project:
Superfish Dropdown Menu
Version:
6.x-1.5
Component:
User interface
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
13 Mar 2010 at 15:19 UTC
Updated:
25 Apr 2010 at 20:20 UTC
Jump to comment: Most recent file
Comments
Comment #1
Lex-DRL commentedsorry, forgot to add one more code tag. In the first line I meant:
Also, I've already read the topics about adding spans to primary links. But as I'm not PHP coder, I can't make it analogically with Superfish menu. So I'm asking for an advice as direct as possible of where and what should I change/rewrite. I didn't find any block.tpl.php in module's folder so I don't know how to modify generated code through theming.
Comment #2
Lex-DRL commentedI have found the solution after long time of googling, studying Drupal API and digging into module files, which I will never do if not this issue.
The wayout I found is overriding theme_superfish_build function by site theme.
You need to write this into the template.php of your theme:
Hope I helped someone in the same trouble.
This is my 1st try of using Drupal API, so I think it's not the best solution. Suggestions are welcomed.
Comment #3
mehrpadin commentedHey there,
Added in v1.4 :)
Comment #4
Lex-DRL commentedMehrpadin, thank you for this amazing module and for reply.
I have tested your updated module and it looks like working as expected. One more thanks for new features (item number, first/last etc).
But I found some... kind of bugs:
Optional request. You did exactly as I did - make module to add this code directly into html. This is "dirty" way because finally generated page contains too much extra code (especially for my example), which is bad for semantics.
As I have googled, usually people add this additional spans dynamically using jquery and something called ".wrapinner" (function?). But as I didn't have a time to dig into JavaScript deeply enough I did it purely by PHP which I at least understand a little.
It will be great if you realise it using JS, which you understand, as I see.
Here is what I have found of how it is "goodly" done in similar situation.
HTML:
JS:
And for browser it looks like this:
I don't know JS at all - even that I don't understand how to modify this code to suit my desires. Shame on me! :(
Sorry for my broken english and long post and thank you again for SuperFish. It is definetly better than Nice Menus even though I need to use this kind of hack for now to make it work as I need.
I'm marking issue as "needs work". If you think that I'm wrong in my suggestions, mark it fixed back.
Comment #5
Lex-DRL commentedI attach to this post a screenshot of Superfish menu I have now with spans described above inserted
inside link to show why I believe that inside is better. "My account" item is hovered. "Add" item is unfolded. Images are used only for background, text is text. All buttons are resizeble to text length.
If someone will need - here is also the same modification to superfish_build function for SF v1.4.
Comment #6
Lex-DRL commentedMehrpadin, thank you for last update. :-)
You have done very good improvement by adding all the options instead of replacing one to another. I have tested the new features and they work well.
Marking this issue as fixed because 2 major things are solved.
2 other things are moved here:
#761446: Expand character limit for Wrappers' fields
#761448: Add wrappers dynamically using JavaScript
Comment #7
mehrpadin commentedHey Lex-DRL,
Pajalosta :) but! your code caused a bug: http://drupal.org/node/764152 , any ideas?
Comment #8
Lex-DRL commentedHm... As I said before, I'm not php coder. So I was expecting for some bugs and warned about that. Sorry.
Post is edited - removed previous suggestions.
Comment #9
Lex-DRL commentedI have googled and tried to better understand l() and menu_item_link() functions and looks like I have fixed that bug. But before I publish solution here I need some little help with php itself to exclude "dirty" code:
Say, I have existing array $array.
And it already has some elements in it ($array['el1'], $array['el2], $array['el3'] etc). But it doesn't have $array['sub_arr'] yet.
I need to create this sub-sub-element: $array['sub_arr']['var'].
Can I simply create that sub-sub-element at 1 step by defining it's value:
$array['sub_arr']['var'] = 'value';or I have to create sub-array first:
Comment #10
Lex-DRL commentedHere is a bugfix for 1.5. I'm not familiar with creating patches yet - so I publish it as function override for your theme.