Would be really great if it accepted some more template suggestions:

menu-block-wrapper-[menuname]_[region].tpl.php
menu-block-wrapper-[$block->delta].tpl.php

I don't find the current menu-block-wrapper-[menuname].tpl.php versatile enough. Sometimes I have two copies of the menu on the page and need to theme only one.

Comments

JohnAlbin’s picture

Category: feature » support
Status: Active » Fixed

You can create your own template suggestions after examining the $settings variable in THEME_preprocess_menu_block_wrapper(). See the instructions on how to do this over at: http://drupal.org/node/223440

nicholas.alipaz’s picture

yes, I know how to do that and have done so. I feel the module should however supply these since it only makes sense.

nicholas.alipaz’s picture

Title: Add menu-block-wrapper-[menuname]_[region].tpl.php to template suggestions » Add menu-block-wrapper-[menuname]-[region].tpl.php to template suggestions
Category: support » feature
Status: Fixed » Active

actually looking back at what I had done was a bit of a hack. The $variables array does not contain the region so getting at what region we are currently in is a bit "hacky" we would minimally need to know the region for the solution proposed by JohnAlbin to work.

Proposed solutions in order of my preference:

  1. Add in the $variable['template_files'] array the menu-block-wrapper-[menuname]-[region].tpl.php
  2. Add the region the menu block is currently in into the $variables array.

I am changing the status back as it now a legitimate feature request since we can't get at the namespace for the region from within template_preprocess_menu_block_wrapper(&$variables). Let me know if I am mistaken.

JohnAlbin’s picture

Status: Active » Postponed (maintainer needs more info)

Unfortunately, menu_block is not told in which region it is being rendered. :-\

m.vo’s picture

Hello,
I was looking into the menu_block code and found that in the settings array returned in THEME_preprocess_menu_block_wrapper we have the "delta" value. Is it not the delta from the 'Block' table ?

If so could we not use it to identify a menu-block from it with a query like this :

select * from blocks where module ='menu-block' and delta='[delta value]' and theme='[your active theme]';

Then you would have the region info from the the 'region' column.

nicholas.alipaz’s picture

that would work m.vo, however I would still consider it a bit "hacky." I mean sql queries in our tpl.php files?!

JohnAlbin’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (won't fix)
nidhitiwari’s picture

My menu blocks links are not going to appear in my custom theme.