Posted by zzadik on October 13, 2009 at 6:40pm
12 followers
Jump to:
| Project: | Special menu items module |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | major |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
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.
<?php
/**
* 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
#1
#2
Thanks, I will review it.
#3
subscribing
#4
any news regarding this issue?
#5
any news?
#6
Hi,
We're a bit busy here. I will do my best to look into this soon and review it.
Best regards,
Khaled Zaidan
#7
bump
#8
this patch is necessary, please include it on the module
thx
#9
Thanks zzadik for working on that
Someone can please make a patch for 7.x and if possible 6.x?
#10
BTW perhaps it works already for D7
#11
Someone can test on D7?
#12
i 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.
#13
Thanks 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.