Post any feature requests or suggestions here. Any ideas for how it could work very welcome, as are patched or code snippets.
| Comment | File | Size | Author |
|---|---|---|---|
| #43 | imagemenu_for_drupal_7-1003072-43.patch | 58.38 KB | nwom |
Post any feature requests or suggestions here. Any ideas for how it could work very welcome, as are patched or code snippets.
| Comment | File | Size | Author |
|---|---|---|---|
| #43 | imagemenu_for_drupal_7-1003072-43.patch | 58.38 KB | nwom |
Comments
Comment #1
RedTop commentedMy suggestion would be that the module (in D7 at least) adds options to the existing menu system rather than offering a new type of menu as is the case now. It would create a more 'integrated' experience.
Menu settings could allow administrators to configure which menus are image-enabled and which imagecache setting should be used for each image-enabled menu. Menu-items in image-enabled menus would offer the option to add an image and a mouse-over image in addition to the text or replacing the text altogether (immediately addressing http://drupal.org/node/786204). Drupal7 is pretty savvy with images now that imagecache has been built in!
Database-wise... maybe add three extra columns to the drupal_menu_links table, two pointing to the relevant imachecache entry/id (called 'imagepath' and 'mouseover' now) and one to save whether text should be shown or not? Also add two columns to drupal_menu_custom, one to hold data whether a menu is image-enabled and one to hold data about the imagecache preset to use for a particular menu.
When uninstalling it would not be that hard to simply delete the columns from the table leaving the 'standard' menu structure in place?
Other things which may be useful are fields for custom css classes, an option for inline or list layout, etc. However, I would focus on getting the basics up and running first. :)
Comment #2
marcus_clements commentedI thought maybe imagemenu could become a plugin for Menu Editor
I think all the things you have suggested could be provided in that framework.
Comment #3
RedTop commentedWow, never really looked at menu editor... looks great!
However, it looks like menu editor only changes how existing options are presented and doesn't really add additional features to the menu system? This means that making imagemenu a plugin for menu editor would create a dependency that doesn't really reduce the effort which needs to put into this module anyway. That said, I do see how imagemenu + menu editor provides a much better user experience.
I wouldn't create a dependency unless menu editor already offers some building blocks and reduces the effort needed to develop imagemenu for D7. I would make menu editor highly recommended though!
Comment #4
jonaswouters commented+1
Comment #5
sander-martijn commentedEven if it works exactly as before just having it work is all I ask for - i just need image based menus (on pretty much every site i build at least one of the menus are designed that way) and think it's absurd that it still isn't here in 7.
My other sites are all still on 5, so my one suggestion may have already been fixed since i last used imagemenu, but what I would like to see is for the mouseover image to be the one used for the active page. In the version i used with 5 this was not the case which means you can't tell what page you're currently on.
Comment #6
BigEd commentedCant we just do a rough dev port to 7 with the same features? Sure its great to have things we like to add but at the moment something is better than nothing.
Comment #7
marcus_clements commentedI would be very happy to review a patch.
Comment #8
drupa11y commentedsubscribe
Comment #9
webankit commented+1
Comment #10
kerios83 commented+1
Comment #11
Andrew Ward commented+1
Comment #12
sylvain_a commented+1
Comment #13
JTxt commentedsubscribe
Comment #14
shortspoken commentedsubscribe
Comment #15
dan_metille commentedsubscribe
Comment #16
mustanggb commentedSubscribing
Comment #17
nothinghere commentedSubscribing
need this !!!
Comment #18
dan_metille commented@nothinghere
I also thought that I needed this, as I wanted to upgrade a site using it from D6 to D7. However, I could manage even better using 'menu_attributes' and some sprite css : http://12bar.kg
Comment #19
beckyjohnson commentedsubscribing
Comment #20
-otto- commentedThis would be great to have in D7, and I like the ideas in #1 .
I'm gonna start with some research on this.
Might take me while, but I think I'll give it a go.
Comment #21
dscutaru commentedSince I need this module for 2 projects I made something similar for D7.
I'm not quite good at drupal's bureaucracy so I'll attach it here.
Still are lot of things which can be done, but it's good enouch for me. There is admin page to chose which menu, to use or not mouse over, preload images, replace menu title, default images. Images are added on menu item edit form, are stored in file_managet table and are tied to menu links by records in file_usage tables. hook_preprocess_menu_link is used to replace menu links with images, so this module will not work with menus displayed with theme_links
Comment #22
Fanaile commented@dscutaru
Thanks for getting this started.
Every thing seems to be working the way that I need it to, except that I can't get the images to change on hover. When I go to edit the menu link, I upload the two images and then click on save. But then if I go back in only the first image is still listed, and it doesn't look as though I've uploaded the second image (for the mouseover) at all.
Looking into my database, I can see the mouseover images in the file_managed table, but they are not listed in the file_usage table.
Comment #23
Kurt Adamson commented@Fanaile
Thanks for getting this started.
Every thing seems to be working the way that I need it to, except that I can't get the images to change on hover. When I go to edit the menu link, I upload the two images and then click on save. But then if I go back in only the first image is still listed, and it doesn't look as though I've uploaded the second image (for the mouseover) at all.
Looking into my database, I can see the mouseover images in the file_managed table, but they are not listed in the file_usage table.
Change in imagemenu.module on line 84 from
if (variable_get('imagemenu_use_hover', FALSE)) {
to
if (variable_get('imagemenu_use_hover', TRUE)) {
and thanks for the code dscutaru :)
Comment #24
Fanaile commented@Kurt A
Thanks, that's perfect! Works like a charm :)
Comment #25
kadimi commentedHere is the code by dscutaru (#21) with the modification by Kurt Adamson (#24)
Comment #26
franksweb commentedThe Image menu is interfering with the Admin menu by suppressing it.
Propably cause:
This Code in the imagemenu.module.php (230-234):
clashes with this code in the admin menu module, admin_menu.module (192-200):
Has anybody any idea in how to tackle this interesting but annoying clash?
Grtz
Comment #27
Edwige K commentedThank you for this module in D7
@franksweb
+1
Did you find a soluce for this problem?
Comment #28
XaviGracia commentedThanks a lot for the contrib...
I would comment if it works OK...
Comment #29
Edwige K commentedThere is also a problem with Field Slideshow.
Slideshow is ok with IE9, Opera, Google Chrome, but the view is always paused with Firefox
Has anyone the same problem? and a solution?
My provisional solution is to disable the "Preload images used on mouse over" fonction in settings, (or comment lines 227-231 in imagemenu.module to prevent the preload fonction's use).
And all is right, waiting a modified version to stop the problem.
Comment #30
-otto- commentedIndeed,
menu_attributes is the perfect solution if you control the site.
If you want a site admin to be able to add menu items, then you need something like imagemenu.
So I guess it depends on what you want.
Comment #31
erald commentedGreat module exactly what I needed.
The only thing I like to have also is a image for the selected page/menu item.
If someone has made that and like to share? Otherwise got to figure out how to make those changes.
Comment #32
anouHello,
I must say that
if (variable_get('imagemenu_use_hover', TRUE)) {...is always TRUE. So I get those notices when updating a menu item :I notice that imagemenu creates this array of variables : imagemenu_settings. And that variable imagemenu_use_hover doesn't exist in bdd.
So to avoid thoses notices I've change the code like this:
maybe i'm wrong... but notices went away
Comment #33
dscutaru commentedyou are 100% correct, missed that line on 2nd rewrite
attached fixed version
Comment #34
anouThanks. Better with the imagemenu_settings() function !! ;-)
Comment #35
erald commentedHad to comment out this part since it gives an error.
Image var is emtpy. think the preg match is wrong somehow..
Comment #36
erald commentedFollow up on #35 and #31
It seems that you cannot get the attr from the mouseover event. That is why you cannot discover the images from the img tag. My knowledge on Jquery is limited so have no idea why this is not working.
For displaying the hover image when the link is active I found a solution. First wanted to get the image via the mouseover attr but as said above the string is always empty. So made a little change in the module.
on line 199 it reads now (added the mytag line)
Then in the js file I added
This way the src of the image is changed to the hover image if the menu link has the active-trail class. I also remove the onmouseout event (this works) to avoid when hovering over the image it is reverting back to the standard image.
Might be there are better ways to do this but this solves a problem I have and is reasonable simple to implement.
If someone has any idea why you cannot get the value from the onmouseout in jquery I would be gratefull.
Comment #37
earthangelconsulting commentedsubscribe
Comment #38
earthangelconsulting commentedI can confirm that #33 with the patch at #36 works for me (under Drupal 7.17)
(you ONLY need #36 if you want the active menu item to display with the same image as a mouseover)
THANKS @dscutaru and @erald for saving my butt!
two important things to know, re: #36
1) "block-menu-menu-tem-trailer-menu" should be replaced with the id of your menu block. i'm sure there's a way to do this in jquery that doesn't require the block name to be hard-coded but i haven't got the time to figure it out at this point.
2) it doesn't say WHERE in imagemenu.js to insert this code! but i can tell you, it should be within the "attach: function (context, settings) {" so the end of your .js should look something like this:
// preload images for mouse over
')[0].src = this;
$(images).each(function() {
$('
});
$('#block-system-main-menu li.active-trail img').each(function () {
var image = $(this).attr('mytag');
$(this).attr('src', image);
$(this).removeAttr('onmouseout');
});
}
};
})(jQuery);
cheers,
Peter "Fish" Fisera
Earth Angel Consulting
Comment #39
earthangelconsulting commentedby the way, something up in the code (in #33), the class names generated for the li tags are ridiculously long and contain much repetition, eg:
id-img-class-imagemenu-image-imagemenu-125-onmouseover-this-src-039-http-dev-bradmcg-com-sites-default-files-styles-large-public-imagemenu-band_o-gif-039-onmouseout-this-src-039-http-dev-bradmcg-com-sites-default-files-styles-large-public-imagemenu-band-gif-039-mytag-http-dev-bradmcg-com-sites-default-files-styles-large-public-imagemenu-band_o-gif-src-http-dev-bradmcg-com-sites-default-files-styles-large-public-imagemenu-band-gif-alt-band-title-band-
i'm sure these could be shortened somehow ;-)
Comment #40
nwom commentedThanks everyone for working on this. I've missed since this Drupal 6. Would you guys recommend the current module in this thread, or the sandbox module here: https://drupal.org/sandbox/s_gupta/1530790?
Comment #41
Anonymous (not verified) commentedWould it be a better use of time and effort to modify and improve https://drupal.org/project/menu_icons ? That project adds the ability to link icons to menu items and do 50% to 70% of what Imagemenu aims to do. More importantly, it seems to have a larger and more active user and developer base than Imagemenu has. It has a few major shortcomings, though:
In short, the menu_icons code is pretty short and could probably be understood in a few days' interpretation. Perhaps it would be easier if we
hijackedassisted that project and fixed its shortcomings rather than redesign Imagemenu from scratch?Comment #42
nwom commentedHere is a patch that combines the changes from #33 and #36 based on the current 6.x-1.x-dev. Please review.
Comment #43
nwom commentedComment #44
pobster commentedYou've closed the "duplicate" the wrong way round, this one has less relevance ... Please read this (and what someone else has written above https://www.drupal.org/project/imagemenu/issues/1003072#comment-8528709); https://www.drupal.org/project/imagemenu/issues/1551664#comment-6067420
This module solved a need some 10 years-plus ago for Drupal 4.5.x (.2 maybe?!) The approach is simply stupid now, and there are already far better alternatives out there which are based on more current thinking.
Comment #45
nwom commentedEither way, at least a patch was created for those that need it.
Comment #46
nwom commentedComment #47
pobster commented...Let it die!!!