[development] Setting the region in hook_block

Sven Decabooter sdecabooter at gmail.com
Thu Jul 8 17:34:06 UTC 2010


If I recall correctly, these settings are only taken into account on 1st
installation of the module (i.e. if there isn't an entry yet in the table
{blocks} for this module-delta combination).
Did you perhaps install the module first, before setting the visibility &
region parameter?
If so, you might want to try to reinstall the module or remove the entry
from the blocks table.
If it's for a contrib module where you want to change the default settings
(but i guess not), you'd have to alter the entry in {blocks} through
hook_update_X().

Sven

On Thu, Jul 8, 2010 at 6:36 PM, Jeff Greenberg <jeff at ayendesigns.com> wrote:

> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20100708/19deebd1/attachment.html 


More information about the development mailing list