Apologies if there is another issue that covers this, but I was unable to find it.
Setup:
- Drupal 7.17
- Bartik 7.17
- i18n 7x-1.8
- Clean install
I am finding that when enabling i18n as per the HowTo: Basic Internationalization setup page, there are some issues around menu items.
Using main menu (Primary links) I have:
- Enabled translation on the basic page content type
- Enabled translation on the menu
- Set a language on the page
- Enabled path auto
- Checked create menu link
- Then translated the page
- Checked create menu link on the translation
As expected I have 2 items in the menu, one for each language. Occasionally I am having issues with the default language item showing in both languages but, my main issue is when editing already translated nodes.
When you edit an already translated node, the menu item becomes "Disabled" and disappears from view... (see screenshot).
Really appreciate some help on this. I am hoping that I have missed a setting somewhere but so far it looks like a bug.
Thanks,
Ashley
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | disabled_menu_items-1905268-3.patch | 780 bytes | martins.bertins |
| Screen Shot 2013-02-01 at 11.26.49.png | 14.94 KB | ashleyhazle |
Comments
Comment #1
ashleyhazle commentedSo I have found the problem.
This is only occurring when you edit a node in a different language.
Example:
You are on http://example.com/en-gb/content/test-page-1 (node 1), you can edit this page without any issues, however! If you are on http://example.com/en-gb/node/2, the French version of the same page but viewed from the English URL, then when you edit this page (en-gb/node/2/edit) you don't have access to the French menu, thus the menu item is disabled.
If you edit the same page from the French url (fr/node/2/edit) then everything is fine and your menu item remains active.
This of course works in reverse too, editing the English version from the French URL.
It still seems to me to be something of a bug. We are looking at writing a small module to check the language of the user agains the language of the node, and redirect to accordingly, but would love to find a more rounded solution.
A
Comment #2
arnoldski commentedThis piece of code works for the basic pages:
Comment #3
ykyuen commentedThe #2 solution works like a charm. Thanks Arnoldski.
here is a modified version. it will set the destination on the url so the user will return to the original path.
Comment #4
martins.bertins commentedHere's a patch I created.
Comment #5
martins.bertins commentedsee Change menu translation approach. (i18n_menu_translated_menu_link_alter() skips item subtree processing)
Comment #6
cdnsteve commentedI tried disabled_menu_items-1905268-3.patch but it didn't work.
For language neutral all menu items become disabled.
If you're in English the opposite language menu items are all disabled.
Reverting to 7.x-1.7 fixes the issue
Comment #7
monsoon commentedHi I have similar issue.
cdnsteve can you please point me where can I get older version 7.x-1.7 of Internationalization?
or if I should use the code given above where should I put it?
Thanks,
Comment #8
cdnsteve commentedSure!
If you have Drush installed:
drush dl i18n-7.x-1.7
Or in zip or tar.gz format:
http://drupal.org/node/1668340
Comment #9
monsoon commentedI still could not fix this issue.
Restoring to older version left all my side bar menu blocks disappeared.
While creating custom module using above code at #3 stopped site from loading node edit forms and generated error "Too many redirects".
Comment #10
Fugazi-2 commented#4 worked for me, thanks.
Comment #11
semiaddict commented#4 seems to work for me as well
Thank you
Comment #12
borutpiletic commentedWhy this "issue" even exists? Is there someting I am missing about menu translation behaviour?
BTW: you could go with
if(strstr($form_id, '_node_form'))instead of regex.And also this code patch gave an error on node translation form (missing nid).
Here is the quick fix:
if(isset($node->nid) && isset($form['#node']) && $form['#node']->type == 'page' && $language->language != $form['#node']->language)Overall thanks for sharing this, menu translation now works as expected.
Comment #13
nchase commentedwith latetest version 7.x-1.10+0-dev this bug still exists. Whenever I edit a node in another language than default the menu item is disabled. total show stopper...
patch in #4 helps.
Comment #14
mastap commentedThis bug still exists.
Comment #15
giorgoskcheck this issue #1693074: Change menu translation approach (i18n_menu_translated_menu_link_alter() skips item subtree processing) since this one has been marked as duplicate
Comment #16
flo81 commentedpatch #4 works for me. Thanks.
Comment #17
thehyperlink commented#4 resolves the issue thank you!
Comment #18
ToRum commentedPatch #4 works indeed. Thanks!
Comment #19
dosnavigator commented#4 it works. Thank you!
Comment #20
webmestre commentedHi,
I'm getting this issue on a correct 7.41 drupal version.
Any idea to fix it ?