-2

I am setting the links as a block in the left panel with the following code.

function notification_block($op = 'list', $delta = 0, $edit = array()) {
  if ($op == 'list') {
    $blocks[0] = array(
      'info' => t('Notification Management'), 
      'weight' => 0, 
      'status' => 1, 
      'region' => 'left',
      'visibility' => 1,
      'pages' => 'notification'
    );

    return $blocks;
  }
 
  else if ($op == 'save' && $delta == 0) {
    variable_set('notification_block_items', $edit['items']);
  }
  else if ($op == 'view') {
    switch ($delta) {
      case 0:
        // Your module will need to define this function to render the block.
        $block = array(
          'subject' => t('Notification Management'), 
          'content' => notification_block_conent(),
        );
        break;
    }
    return $block;
  }
}
  
function notification_block_content() { 
     $ret = '<a href="'.$base_url.'/notification/addTemplate">Add new email template</a>';
     $ret .= '<br/><a href="'.$base_url.'/notification">Manage Email Notfication</a>';    
     return $ret;
}
``

Unfortunately, this block is appearing in all the pages. I need to display this block on the notification module only. How can I achieve this?

1
  • In the block settings you can configure pages, where this block should appears. Is it solved your problem?
    – Eugene
    Commented Aug 17, 2015 at 15:39

1 Answer 1

2

Go to the block configuration page and scroll down to Page specific visibility settings.

There are the following options.

Show block on specific pages:

  • Show on every page except the listed pages.
  • Show on only the listed pages.
  • Show if the following PHP code returns TRUE (PHP-mode, experts only).

If you are using last option from the above options, see Display block on certain page.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.