Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Same issue is here for version 6.x.2.4. After update node option menu icon is reset.
Comment | File | Size | Author |
---|---|---|---|
#17 | menu_icons-icons_disappear_after_edit-1437184-redo.patch | 2.75 KB | florisg |
#16 | menu_icons-icons_disappear_after_edit-1437184-6190248.patch | 2.87 KB | florisg |
#6 | menu_icons.patch | 2.92 KB | emilorol |
Comments
Comment #1
bettibio CreditAttribution: bettibio commentedMenu icon is rock but with this problem becomes unusable. No solution or suggestion?
Comment #2
acrollet CreditAttribution: acrollet commentedclosing as duplicate of #953456: Menu Icons disappear after editing node associated with menu item - once the code has been fixed in one version, it'll be ported to the other.
Comment #3
acrollet CreditAttribution: acrollet commentedRe-opening to track this issue in version 7. Please post exact steps to reproduce the issue.
Comment #4
acrollet CreditAttribution: acrollet commentedAs a clarification, without a patch to review, I'll need exact steps to reproduce the issue from a clean drupal 7 install.
Comment #5
emilorol CreditAttribution: emilorol commentedHi,
I can confirm this is happening.
1. A clean install of Drupal 7
2. Installation of menu, menu_icons, menu_taxonomy, menu_trails
3. Create a vocabulary and add some terms
4. Link the vocabulary to a menu (I used Main menu)
5. Go the to menu and upload images to the menu
6. Create a content type (enable the menus if you want the results are the same)
7. Add the vocabulary field if you don't have menus
8. Save
9. Create a new page using the content type you just created and watch how the icon on the menu is gone.
Thank you,
Emil
Comment #6
emilorol CreditAttribution: emilorol commentedHi,
Well here is a patch that solves a couple of issues, but it is far from perfect. The current patch will use a site variable to store the menus options connected thru the menu link id (mlid) and then every time the css is regenerated the menu options are check against what is stored and if different they are loaded with the stored values and the changes are also saved on the menu_links table so that the process will not have to be repeated next time.
The idea behind this patch is to have an store location of the menu option in case they are deleted by any reason like when creating and/or updating a node.
Why it is far from perfect?
1. I you have created a menu with icons already by the time to apply this patch you will have to re-save all the menu items in order to get their options store outside the menu_links table.
2. Once you have an store copy of the menu options if you create or update a node the menu icon will show until you clear your cache.
Note: I tried another over killing solution forcing a regeneration using hook_node_update and hook_node_insert without luck.
Thank you,
Emil
Comment #7
agoradesign CreditAttribution: agoradesign commentedHi,
thanks for the patch Emil!! It did 99% of that what I needed and I've done the last steps by myself:
In order that Taxonomy Menu module stops overwriting the icon settings, I've done two things:
Implementing hook_taxonomy_menu_update()
...is very easy. I've done it with an own module, but it wouldn't harm if Menu Icons would implement it like that:
But unfortunately that alone doesn't help if we don't
manipulate Taxonomy Menu module
Unfortunately the options property of the link item we have set above gets overridden by Taxonomy Menu module when saving because it is setting the options from ground up, no matter if the parameter already has set some options. So I've manipulated that module code and opened up an issue (which contains my proposed changes to that module): http://drupal.org/node/1579046
Comment #8
paknight CreditAttribution: paknight commentedregarding #7 I'm a little confused as to how you got your results. Did you create a new .module file with-in menu_icons or an entire module to refer to this. I'm using the taxonomy menu, menu_icons and the nice menus. I performed the following
1)I have already applied the menu_icon.patch file
2)cut and pasted this function into the menu_icons.module file
I have no icons showing up.
Would appreciate help
Thank-you
Peter
Comment #9
emilorol CreditAttribution: emilorol commented@paknight: try clearing the cache and if you re-build the menu then you might have to re-upload the files.
Comment #10
agoradesign CreditAttribution: agoradesign commented@paknight:
I created an entire new module to do this, just because it is cleaner to not modify an existing module if you have the choice. In this case you have to name the function according to your module's name: modulename_taxonomy_menu_update()
But of course it also works if you copy the function 1:1 into the menu_icons.module like you did.
The only reason why it didn't work, is, that you have missed out step 3: as I mentioned above you have to modify Taxonomy menu module also because the module is ignoring/overriding the options we are setting in our hook. See this issue for details how to modify that module: http://drupal.org/node/1579046
Comment #11
emilorol CreditAttribution: emilorol commented@paknight:
Just as a quick note agoradesign mean the Taxonomy menu module and not the Taxonomy core module.
Comment #12
agoradesign CreditAttribution: agoradesign commentedThank you Emil! I have corrected my post
Comment #13
paknight CreditAttribution: paknight commentedThank-you for your reply. Sorry for taking so long to respond. I did your step 3 and added your code into the Taxonomy_menu.module and am still having the issue of the icons disappearing. I have worked little with the PHP and Drupal modules so I'm likely missing something. You added the statement "and set this $options array in the $item array instead" . Is this something else I need to do?
Comment #14
agoradesign CreditAttribution: agoradesign commentedHi,
oooops shame on me.... I was in hurry, when I wrote that post. I didn't mean $item array, but $link array. Above the code I've named it correctly: "You should do something like that before defining the $link array:" -> When you look at line 597 of the original code in the file taxonomy_menu.module, you see the def of the $link array, where 'options' is set from ground up. Here you should use your $options array as value instead
Comment #15
florisg CreditAttribution: florisg commentedRebuild emilacosta patch against 7.x-3.0-beta3+0-dev
Comment #16
florisg CreditAttribution: florisg commentedthe patch for #15
Comment #17
florisg CreditAttribution: florisg commentedredo with right parameters: -ruN
Comment #18
emilorol CreditAttribution: emilorol commentedIt looks good to me.
Comment #19
aisamat CreditAttribution: aisamat commentedI have the same issue.
Why not an official update of this module?
Comment #20
SKAUGHTi've applied this patch [#17]and things seem to be working.
Comment #21
acrollet CreditAttribution: acrollet commentedI appreciate the effort by @emilacosta and @idevit, but unfortunately I'm not prepared to use this approach. The infinitely preferable approach is for taxonomy_menu to stop overwriting our (and possibly other module's) data, and the effort to change this may be followed here: #1579046: preserve menu link options when saving. If the taxonomy_menu maintainers express that they will not fix the issue from their side, we can re-open this issue and discuss the best approach to take. I've made a note on the project page that taxonomy_menu is currently incompatible with menu_icons.
Comment #22
JamesRobertson CreditAttribution: JamesRobertson commentedI applied the patch and it doesn't work for me. Icons still disappear!
Comment #23
lightsurge CreditAttribution: lightsurge commentedSame here although putting the code for the hook_taxonomy_menu_update into taxonomy_menu's own implementation of the hook got it working for me, so I guess it might be a module weight issue and it needs to go into a custom module with a higher weight than taxonomy_menu.
menu_icons and taxonomy_menu are both weight 0, so the code probably has to go in a custom module of at least weight 1... though I've not tested yet.
Comment #24
klimpI've tested solution with custom module weighing more than 0 like as offered in #23 and it seens if works for me. I didn't modify taxonomy_menu module.
Comment #25
antonior14 CreditAttribution: antonior14 commentedHi!
I tried to apply patches with this command on my linux webserver
curl https://www.drupal.org/files/menu_icons-icons_disappear_after_edit-14371... | patch -pl
patch: **** strip count l is not a number
but it returns (23) Failed writing bod
I use Drupal , and installed Menu Icons 7.x-3.0-beta4
thanks a lot
Comment #26
antonior14 CreditAttribution: antonior14 commentedHi! When I tried to apply patches it returns
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2813 100 2813 0 0 7402 0 --:--:-- --:--:-- --:--:-- 7481
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|--- menu_icons.module.original 2012-07-03 15:04:37.955821463 +0200
|+++ menu_icons.module 2012-07-03 15:19:14.555823783 +0200
--------------------------
File to patch:
Can you help me, please?