Hi,
in my recent project I'm using Taxonomy Menu module as well as Menu Icons. Unfortunately Taxonomy Menu interferes the other module, so that after updating a term, the menu icon setting gets overwritten.
So I was implementing hook_taxonomy_menu_update() in order to set the 'options' attribute of the menu link with the existing data (containing the icon configuration). So long, so good. But when I tested this functionality I've seen that the settings are still overridden.
Why? Because in the _taxonomy_menu_save() function you are setting the 'options' property of the link from ground up, instead of checking if the parameter has already set some options and use them, if present.
You should do something like that before defining the $link array:
$options = isset($item['options']) ? $item['options'] : array();
if (!isset($options['attributes'])) {
$options['attributes'] = array();
}
$options['attributes']['title'] = trim($item['description']) ? $item['description'] : $item['name'];
and set this $options array in the $link array instead.
I'm sorry to not proposing a patch here, but I'm a git n00b. I've done it once successfully, but failed creating one (with Aptana) a few days ago and don't know why... I guess I'd need some time to figure out again, what I've done wrong, but I don't have this time now...
Comments
Comment #1
whimsy commentedI am having this same issue in version 6. In the Menu settings, I changed the Menu Link Title as it is different then the taxonomy term. Whenever I add or modify a node, my Menu Link Title is wiped out and reset to the taxonomy term by Taxonomy Menu. I can get around this by unchecking the Synchronise changes to this vocabulary option in the Taxonomy Menu settings but this causes other issues.
Comment #2
acrollet commentedHi there,
I'm the 7.x maintainer of the menu_icons module, and I can confirm that taxonomy_menu is incompatible with menu_icons. (and any other module that saves data in the menu link options) It would be wonderful if taxonomy_menu could be re-worked to change this behavior.
Comment #3
hles commentedI don't think it would happen in 7.x-2.x, someone up to confirm that ? Would be great !
Comment #4
hles commentedComment #5
hles commentedComment #5.0
hles commentedcorrected typo error: $options array need to be used in $link, not in $item
Comment #6
zmove commentedI reopen the issue because there is the same problem with Icon api and Menu icon submodule.
To reproduce :
I don't think it need another issue as the title of this one perfectly describe the problem. Just put it active again :/
Comment #7
oxyc commentedFor reference, this is how I solved it with a hook.
Comment #8
zmove commentedThe code above doesn't work for me. When I make some change in my taxonomy, my menu icons provided by icon api still disappears.
Comment #9
init90One more related example:
Comment #10
vladimirausThank you for your contributions.
Drupal 7 is no longer supported.
Closing this issue as outdated.