Hi,

I'm not sure if there is better way to do this, but I was wondering if there is any way to assign multiple fixed parent items for menu block so I don't have to add own menu block for each language.

I have multisite with ~10 languages with the following menu structure:

main-menu link 1 (russian)
-- parent 1
-- parent 2
-- parent 3
-- parent 4
main-menu link 1 (english)
-- parent 1
-- parent 2
-- parent 3
-- parent 4

all menu items are views pages and I'd like to show menu block on node pages without assigning parent menu items for nodes.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

monish_deb’s picture

The only possible solution I get out of this is want to get a option at the menu block on page view which will be a link saying "Translate to Russian" (likewise for other 9 languages), clicking on which the whole menu block with be transformed or load into chosen language. Am I right on this ?

nozies’s picture

No. For example, I have a content type called "News" with 5 different categories and Views page with contextual filter for the category. Then I have 6 menu items: News (parent menu item), Category 1, Category 2 ... which all are child menu items of the "News"

News (level 1), path: /news
-- Category 1 (level 2), path: /news/category-1
-- Category 2 (level 2), path: /news/category-2
....
-- Category 5 (level 2), path: /news/category-5

And menu block with "fixed parent menu item" pointing to the "News" and because of "fixed parent menu item" setting I can show menu block under node pages too (even when they don't have any relation to news or category pages).

... and every language has their own menu items, which means I have to add separate menu block for each language.

zd370’s picture

@nozies, I am in the same boat as you are. I have 12 languages enabled on my site. I am using the Menu Block to create a left-side navigation. I have a separate menu for each language. I, too, want the option of selecting a different menu/fixed parent for each of those languages instead of creating 12 menu blocks.

I am working on a patch that allows me to do just that. I will hopefully post it in a day or two.

zd370’s picture

I am submitting a patch for an experimental feature. Please do not commit this patch.

More info about the experimental feature:
Before a menu block is rendered in hook_block_view, it checks for the multilingual counterpart of selected menu. Instead of having to create a different menu block for each language, you only need to create one block.

For example, on a multilingual site, you have following menus:

  • Main Navigation (Default - English), machine name: menu-main-navigation
  • Main Navigation (French), machine name: menu-main-navigation-fr
  • Main Navigation (Spanish), machine name: menu-main-navigation-es

In your menu block configurations, if you have selected Main Navigation (Default English) for menu, when you switch to French, menu block will use Main Navigation (French) menu, and so on. If there is no multilingual counterpart of the selected menu, it will use the selected menu.

I am working on another patch which would allow you to select both menu and fixed parent item per language (as @nozies requested).

richsky’s picture

It would be so great!

richsky’s picture

Issue summary: View changes

typos