Secondary menu not showing up
yingtho - February 22, 2008 - 11:10
| Project: | Localizer |
| Version: | 5.x-3.10 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I can see the secondary menu translation but when i go to the primary link then the secondary link doesn't show up. But if I do edit content then it shows the secondary link correctly.
| Attachment | Size |
|---|---|
| Secondary menu not showing.png | 5.81 KB |
| Secondary menu showing up.png | 5.57 KB |

#1
What I forgot to mention that this is upgraded from localizer 1.10.
#2
I have exacly the same problem.
#3
Me too.
When I disable localizer modul, I see secondary links.
Also, all themes have the same problem -> so it is not a theme issue.
#4
I found the reason for menu confusion; here is an explanation and temporary dirty workaround :
A little background for newbies as I am, that don't know the drupal menu system (I figured it out looking at the sources) :
The menus get generated in a $_menu variable, that gets menu items as associative arrays.
Each has a ['path'] value, that drupals gives as the "real" path to the item (node/xxx for a regular node)
Localizer's localizer_translate_all() function that gets called when building the menu replaces this path with the translated one, to properly handle language switch.
But in menu.inc, we get at line 975 (for Drupal 5.10) :
<?phpif (isset($item['path']) && ($item['path'] == $path || ($item['path'] == '<front>' && drupal_is_front_page()))) {
?>
That searches the menu item's path for correspondance with the current page's path ($path here).
but the menu item's path here is not the "real" path anymore, but the aliased, translated path (could be "more_information", instead of "node/48")
so by just adding another test that re-translates the item's path to a "real" path, you can improve the detection a bit :
<?phpif (isset($item['path']) && ($item['path'] == $path || drupal_get_normal_path($item['path'])==$path || ($item['path'] == '<front>' && drupal_is_front_page()))) {
?>
Here is what worked for me.
Unfortunately I don't have the time nor the knowledge to search for a proper way using only localizer, so I leave it up to you guys :)