When a menu is used for nodes with different languages (the 'Translate and Localize' option), there are currently 2 options for the parent items drop-down in the menu settings of the node edit form:
1. with the 'Select nodes by language' option OFF for 'Content to filter by language':
parent items in all languages are shown -> not so handy, confuses the moderators
.if eg. 'contact' is available in EN + FR, and a subpage must be added, one can not tell where to actually add it (as it is impossible to tell which is the EN or FR)
2. with the 'Select nodes by language' option ON for 'Content to filter by language':
the drop-down shows only menu items for the CURRENT language -> this is almost perfect:
.except when coming from the translate tab of the node, then the language is restricted to the language of the original node (eg. original node is EN, when translating to FR, the parent items/menu is still EN, so it is impossible to add them correctly)
.or coming from 'create node' and switching the language of the node on the edit form, the parent items drop-down does not reflect this
Ideally, the drop-down content (language of menu items) would reflect the language selected on the node edit form (when loaded + when node language is changed/updated).
Is this possible?
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | restrict_parent_menu-5043252-15.patch | 2.65 KB | idflood |
| #7 | restrict_parent_menu-v2.patch | 2.54 KB | thijsvdanker |
| #4 | restrict_parent_menu-5043252-4.patch | 2.37 KB | idflood |
Comments
Comment #1
jose reyero commentedChanging component to Menus
Comment #2
candelas commentedcould this be fixed by a json script?
when the language is choosen, then change the parent menu...
i wish i knew howto...
or with jquery if all the menu options were loaded?
thanks for the module, it is incredible :)
Comment #3
idflood commentedsubscribing
Comment #4
idflood commentedHere is a first patch that tries to address this issue. The only problem I've found so far is by doing the following:
- go to node/add/page
- change the language select
- then refresh the page.
Comment #5
g10 commentedHi idflood, the patch kinda works:
if Configuration > Multilingual settings > Content to filter by language > Select nodes by language is checked
- the menu is showing the menu items in the correct language
- but the node language stays in english !?
this is, if on an EN node, going to the translate tab, and translate the node in eg. FR: the menu is FR, but the language drop down stays EN
Comment #6
jose reyero commentedComment #7
thijsvdanker commentedUpdated patch #4:
- edit now shows the current user's language when coming from language neutral
- shows the right node language
I basically used the #4 patch and played around until it appeared to be working, so the logic might be off, please review :)
Comment #8
minff commentedThe patch in #7 worked for me, despite being a rather ugly hack.
Comment #9
bigslott commentedThe patch in #7 worked for me, Thanks!
Comment #10
jose reyero commentedThe idea of the patch looks good though there are some and issues and anyway this is just a partial solution. I mean there are other things in the node form that may change when switching language (taxonomy terms, references, etc) and we need to find some way that can fix all of them at once. This would block changing other form elements when switching language.
Also there are some issues with the patch like messing with global variables that are not reset later (you cannot assume other modules are not altering the form too). Switching global language should be encapsulated better, maybe adding our own function to build menu options. Also check out 'menu_override_parent_selector' variable.
But in general we should aim for a better solution that really fixes all these node form issues that happen when switching language, like not allowing to change the node language and adding a previous step to decide language, or a language selector like the one for variable settings forms.
So nice patch, it will work, it just won't fix the whole problem.
Comment #11
Wolfgang Reszel commented#7: restrict_parent_menu-v2.patch queued for re-testing.
Comment #13
rv0 commentedPatch doesn't apply
manual patching did not result in any change of the available menu items.
Comment #14
Anonymous (not verified) commentedIs there any update on this issue?
Comment #15
idflood commentedI needed to update i18n on a website where I was using this patch so here is a reroll of the patch in #7.
Comment #16
idflood commentedComment #17
jose reyero commentedOk, but moving back to 'needs work', see #14
Comment #18
Sinan Erdem commentedWhat about fixed language menus?
I have two languages, and two menus, each is fixed to one of the languages. When I add a node in English for example, I can still see the other menu items on the menu selection dropdown.
Comment #19
manuel.adan#16 seems not working when hierarchical_select module is in use.