I don't recall if there is a cleaner way to do this in Drupal 5, but as a kludge in your 'view' case you could check the path and only return the block array if you are on an admin page. For example: case 'view': $blocks['subject'] = t('Create email contacts'); $blocks['content'] = t('My email contact content'); if (arg(0) == 'admin') { return $blocks; } On Wed, Jan 27, 2010 at 1:18 PM, ktt <kestutis98@yahoo.com> wrote:
Thank you for exact answer. I use DRUPAL 5.21, and it seems, this option isn't available: http://api.drupal.org/api/function/block_example_block/5
My code didn't work for admin/* :
function EmailM_block($op='list' , $delta=0, $edit=array()) { switch ($op) { case 'list': $blocks[0] = array( 'info' => t('Example: EMAIL M'), 'status' => TRUE, 'weight' => 0, 'visibility' => 1, 'pages' => 'admin/*', ); return $blocks; case 'view': $blocks['subject'] = t('Create email contacts'); $blocks['content'] = t('My email contact content'); return $blocks; }
}
Regards, Ktt
--- On Wed, 1/27/10, William Smith <william.darren@gmail.com> wrote:
From: William Smith <william.darren@gmail.com> Subject: Re: [development] Block visibility only in module pages To: development@drupal.org Date: Wednesday, January 27, 2010, 6:44 PM Yes, you should be able to do this from the module code. See the block_example code at http://api.drupal.org/api/function/block_example_block/6
Note the 'pages' array element (in the example code it is specified as 'node/*'). In your case, you would want to set this to 'admin/build/modules'
Best, William
On Wed, Jan 27, 2010 at 11:33 AM, ktt <kestutis98@yahoo.com> wrote:
Hello,
Is it possible to define block to show only in module pages?
I would like to define that in module code - is it possible?
Thank you in advance,
Ktt