This module is small, but fantastic at the same time.
I found out that it didn't work properly with my multilingual site.
I hacked the code to support i18n, but I'm new to "Patching", so would like someone to add the patch from the code below, or instruct me on how to add a patch.
/**
* Override of theme_menu_item_link()
* This function will render link if it is "nolink" or "separator". Otherwise it will call originally
* overwriten menu_item_link function.
*/
function special_menu_itemsoverwrite_menu_item_link($link) {
$theme_overwrite=variable_get('oldtheme_menu_item_link',null);
if (empty($link['localized_options'])) {
$link['localized_options'] = array();
}
if(strpos($link['href'], 'nolink') === 0) {
// Verify that i18n module is installed, otherwise skip check
if (module_exists('i18n')) {
// Verify that the link is set for the current language
if (i18n_get_lang() != $link['localized_options']['langcode'])
return;
}
// Allow if the menu link is nolink:
$link['localized_options']['html'] = TRUE;
//Retrieve tag for nolink menu item
$tag=variable_get('special_menu_items_nolink_tag','<span>');
//Set class for nolink
$css='nolink';
//Return HTML span instead of a link
return render_menu_item($tag,$link['title'],$css);
}
else if(strpos($link['href'], 'separator') === 0) {
// Allow if the menu link is seperator
$link['localized_options']['html'] = TRUE;
//Retrieve tags and value for seperator menu item
$tag=variable_get('special_menu_items_seperator_tag','<span>');
$value=variable_get('special_menu_items_seperator_value','--------');
//Set class for seperator
$css='seperator';
//Return separator menu item
return render_menu_item($tag,$value,$css);
}
else
return call_user_func($theme_overwrite, $link);
}
Thanks,
Zion
Comments
Comment #1
zzadik commentedComment #2
tamerzg commentedThanks, I will review it.
Comment #3
metabits commentedsubscribing
Comment #4
mariusilie commentedany news regarding this issue?
Comment #5
dtsio commentedany news?
Comment #6
khaled.zaidan commentedHi,
We're a bit busy here. I will do my best to look into this soon and review it.
Best regards,
Khaled Zaidan
Comment #7
alex.skrypnykbump
Comment #8
kimlop commentedthis patch is necessary, please include it on the module
thx
Comment #9
gagarine commentedThanks zzadik for working on that
Someone can please make a patch for 7.x and if possible 6.x?
Comment #10
gagarine commentedBTW perhaps it works already for D7
Comment #11
gagarine commentedSomeone can test on D7?
Comment #12
candelas commentedi used in drupal 7.8 and internationalization and i am able to translate it and no problems.
i didnt use the patch...
thanks a lot for your work :)
edit it works in the interface but when you create a new node, the menu item that it is translated gets duplicated in the select to choose a menu parent item...
but not only with this module, but with any menu item created directly from the menu.
i opened an issue in the internationalization module http://drupal.org/node/1269318
if i found a solution, i will tell here.
Comment #13
gagarine commentedThanks a lot for your tests :).
I'm not going to work on the D6 (I do not have any D6 websites using this module) but if someone can provide a patch it will be great.
A cleaner solution would be to port the way of the D7 version work to D6.
Comment #14
vrajak@gmail.com commentedNeeding some help with this. Applying the hack from the first post does remove the names of the menu items, but leaves the menu section visible. I attached a screnshot.
Any tips?
Comment #15
vijaycs85Not sure how helpful it is, but here is the patch for the code in description.