Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
JohnAlbinYou 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
Comment #2
nicholas.alipaz CreditAttribution: nicholas.alipaz commentedyes, I know how to do that and have done so. I feel the module should however supply these since it only makes sense.
Comment #3
nicholas.alipaz CreditAttribution: nicholas.alipaz commentedactually 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:
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.
Comment #4
JohnAlbinUnfortunately, menu_block is not told in which region it is being rendered. :-\
Comment #5
m.vo CreditAttribution: m.vo commentedHello,
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.
Comment #6
nicholas.alipaz CreditAttribution: nicholas.alipaz commentedthat would work m.vo, however I would still consider it a bit "hacky." I mean sql queries in our tpl.php files?!
Comment #7
JohnAlbinComment #8
nidhitiwari CreditAttribution: nidhitiwari commentedMy menu blocks links are not going to appear in my custom theme.