[development] Setting the region in hook_block

Jeff Greenberg jeff at ayendesigns.com
Thu Jul 8 16:36:12 UTC 2010


I have a theme that contains the region content_bottom. The region 
appears in the select boxes at admin/settings/block.  I have a module 
that implements hook_block with:

function mymodule_block($op = 'list', $delta = 0, $edit = array()) {
   switch ($op) {
       case 'list':
           $blocks[block1] = array(
               'info' => 'Block 1',
               'cache' => BLOCK_CACHE_GLOBAL,
               'weight' => -1,
               'status' => 1,
               'visibility' => 1,
               'region' => 'content_bottom',
               'pages' => '<front>',
           );
           return $blocks;

and the block always appears in the disabled list. I tried using TRUE 
instead of 1 for status, which shouldn't make a difference, and didn't. 
The docs don't actually give an example of using region, other than 
saying you can, and a grep of 'region' starting at the document root in 
a module-laden sandbox seems to come up empty, so I'm not quite sure 
where to look.

Jeff



More information about the development mailing list