Define all blocks provided by the module.
This hook declares to Drupal what blocks are provided by your module and can optionally specify initial block configuration settings.
In hook_block_info(), each block your module provides is given a unique identifier referred to as "delta" (the array key in the return value). Delta values only need to be unique within your module, and they are used in the following ways:
The values of delta can be strings or numbers, but because of the uses above it is preferable to use descriptive strings whenever possible, and only use a numeric identifier if you have to (for instance if your module allows users to create several similar blocks that you identify within your module code with numeric IDs). The maximum length for delta values is 32 bytes.
An associative array whose keys define the delta for each block and whose values contain the block descriptions. Each block description is itself an associative array, with the following key-value pairs:
Most modules do not provide an initial value for 'visibility' or 'pages', and any value provided can be modified by a user on the block configuration screen.
For a detailed usage example, see block_example.module.
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
function hook_block_info() {
// This example comes from node.module.
$blocks['syndicate'] = array(
'info' => t('Syndicate'),
'cache' => DRUPAL_NO_CACHE,
);
$blocks['recent'] = array(
'info' => t('Recent content'),
);
return $blocks;
}