[development] Block visibility only in module pages

ktt kestutis98 at yahoo.com
Wed Jan 27 18:18:43 UTC 2010


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 at gmail.com> wrote:

> From: William Smith <william.darren at gmail.com>
> Subject: Re: [development] Block visibility only in module pages
> To: development at 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 at 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
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 


      


More information about the development mailing list