2

How can I have specific menu_tree and menu_link for specific region?

Example:

left region will have his own menu_tree menu_link which will be different from the right region.

How can I achieve this?

Do I need to build a custom module?

If I use template_preprocess_region() , how can I call menu_tree and menu_link?

Thanks in advance

----------- UPDATE ----------------------

I've seen that preprocess_block gives back "region" and "module". Is there anyway to use the different menu_link() and menu_tree() depending on the region and module?

2 Answers 2

2

To theme only specific regions within your drupal page simply filter your css by prefixing your class with the class or id of the region in question. You can find the region by inspecting HTML output. I use chromes inspector which is accessed via inspect element within contextual menu.

#region-sidebar-first .menu_tree menu_link_my_class { css }

and if you want a different style for the right hand sidebar

#region-sidebar-second .menu_tree menu_link_my_class { css }
5
  • oops, just reread this. Not sure that my answer was too relevant. Commented Dec 10, 2012 at 14:55
  • It seems the right answer to me: menu_tree() doesn't get any parameter saying in which region the menu is being rendered.
    – apaderno
    Commented Dec 10, 2012 at 15:02
  • But I need to override the ul classes or replace ul with ol or with divs. I need to do it region by region. Commented Dec 10, 2012 at 15:08
  • mmm, perhps it was relevant after all. Why do you need to replace the markup? Can you ul some markup and what you are trying to achieve with it? Commented Dec 10, 2012 at 20:07
  • Nope, I need to add specific classes for menu and sub menu. Commented Dec 20, 2012 at 13:55
1

Use the menu_block module together with hook_block_view_MODULE_DELTA_alter()

1
  • This will work block by block, I want region by region. Commented Dec 20, 2012 at 20:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.