Search code examples
drupaldrupal-7drupal-modulesdrupal-theming

Why won't my block statement work in Drupal 7?


    $block['content'] .='<span style="display:none" class="tc_msg">YOU ARE NOW LOGGED OFF</span>';
  $block['content'] .='</span>';
  return $block;

I see nothing on screen


Solution

  • For one thing, you are closing the span twice. Second, the style="display:none;" hides that whole span.

    Since you are returning html, I assume you are placing this inside the hook_block_view() http://api.drupal.org/api/drupal/modules%21block%21block.api.php/function/hook_block_view/7

    If the above code is all that is going into $block['content'] then try removing the . from the first .= so there is no question as to what 'content' contains.

    Have you assigned this block to a region of your site, or is it sitting in the Disabled section of your block management? That would also cause you to not see it on the site.