Drupal 6 – Create a custom block that contains an entire block region

This snippet is very handy if you need to place an entire block region into a panel. I have used 'left' region for this demo, but feel free to change this to any region.

<?php
/**
* Implementation of hook_block().
*/
function MODULENAME_block($op = 'list', $delta = 0){
   
$block = array();   
    switch (
$op) {
        case
'list':
           
// left region
           
$block[0]['info'] = t('Block region - left');
            return
$block;           
           
        case
'view':           
            switch (
$delta) {
               
// left region
               
case 0:
                   
// get all blocks in left region
                   
$blocks_left = block_list('left');
                   
// cycle through each block
                   
foreach($blocks_left as $block_left){
                       
$output .= theme('block', $block_left);
                    }
                    break;
            }
           
// assign the markup
           
$block['content'] = $output;       
           
            return
$block;
    }
}
?>

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>