php - How do I change the output of drupal 7 menu blocks in one specific region? -
so have several menu blocks in region 1 drupal 7 site. need wrap each of these menu blocks in <section>
tag, leave other menu blocks unaffected. thinking preprocess region, check if blocks menu blocks, , can see, attempt wrap output in section tag. can please tell me i'm doing wrong? problem killing me.
function mytheme_preprocess_region(&$vars){ //checks see if we're in correct region if($vars['region'] == "footer-top"){ //loops through every block in our region foreach($vars['elements'] $key => $item){ $block_type = $item['#block']->module; //if it's menu block, wrap output in section tag, doesnt work if($block_type == "menu_block"){ //$vars['elements']['menu_block_4']['#children'] = "<section>" . $item['#children'] . "</section>"; $vars['elements'][$key]['#children'] = "<section>" . $item['#children'] . "</section>"; } } } }
look block templating. base block template in modules/block/block.tpl.php. can override base template specific block.
basically need create new block template file in theme folder.
Comments
Post a Comment