block_example_block_list

Versions
7
block_example_block_list()

Implementation of hook_block_list().

This hook declares to Drupal what blocks are provided by the module.

Code

developer/examples/block_example.module, line 14

<?php
function block_example_block_list() {
  // This hook returns an array, each component of which is an array of block
  // information. The array keys are the 'delta' values used in other block
  // hooks.

  // The required block information is a block description, which is shown
  // to the site administrator in the list of possible blocks. You can also
  // provide initial settings for block weight, status, etc.

  // This sample only provides a description string.
  $blocks['configurable-text'] = array(
    'info'       => t('Example: configurable text string'),
  );

  // This sample shows how to provide default settings. In this case we'll
  // enable the block and make it visible only on 'node/*' pages.
  $blocks['empty'] = array(
    'info'       => t('Example: empty block'),
    'status'     => TRUE,
    'weight'     => 0,
    'visibility' => 1,
    'pages'      => 'node/*',
  );

  return $blocks;
}
?>
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.