0

I have the following code. It does create the block but I still cannot figure out why it is not adding that block to the desired region and also pages visibility settings are not working. What am I missing?

function my_module_block_info() {
  $blocks = array();
  $blocks['lp_sidebar'] = array(
    'info' => t('Lesson Planner'),
    'status' => TRUE,
    'region' => 'nav_column',
    'visibility' => BLOCK_VISIBILITY_LISTED,
    'pages' => "lesson-planner\r\n"
  );

  return $blocks;
}

function my_module_block_view($delta = '') {
  $block = array();
  switch ($delta) {
    case 'lp_sidebar':
      $block['subject'] = '';
      $block['content'] = _my_module_get_steps();
      break;
    }

    return $block;
  }
  • Are you able to see that block in the admin > structure > block section? Please verify that, that block is NOT in the "None" regions section. If it is there, then drag it to your desired region. Apart from that, make sure that _my_module_get_steps() is returning some response. – PHP Team Feb 7 '15 at 9:25
  • The block gets created just fine and it is in the right region as programmed on hook_info(). But for some reason the field 'pages' is blank. – roosevelt Feb 8 '15 at 18:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.