block_example_block_view

Versions
7
block_example_block_view($delta = '')

Implementation of hook_block_view().

This hook generates the contents of the blocks themselves.

Code

developer/examples/block_example.module, line 88

<?php
function block_example_block_view($delta = '') {
  //The $delta parameter tells us which block is being requested.
  switch ($delta) {
    case 'configurable-text':
      // The subject is displayed at the top of the block. Note that it
      // should be passed through t() for translation.
      $block['subject'] = t('Title of block #1');
      // The content of the block is typically generated by calling a custom
      // function.
      $block['content'] = block_example_contents(1);
      break;
    case 'empty':
      $block['subject'] = t('Title of block #2');
      $block['content'] = block_example_contents(2);
      break;
  }
  return $block;
}
?>
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.