block_example_contents

Versions
4.6 – 7
block_example_contents($which_block)

A block content function.

Code

developer/examples/block_example.module, line 64

<?php
function block_example_contents($which_block) {
  if ($which_block == 1) {
    // Modules would typically perform some database queries to fetch the content
    // for their blocks. Here, we just return a string.
    return t('Some example content.');
  }

  if ($which_block == 2) {
    // It is possible that your block will not have any content, since it is
    // probably dynamically constructed. In this case, Drupal will not display
    // the block at all.
    return;
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.