You are here

function hook_block_info in MongoDB 7

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.

Return value

array 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:

  • cache: (optional) A bitmask describing what kind of caching is appropriate for the block. Drupal provides the following bitmask constants for defining cache granularity:

  • weight: (optional) Initial value for the ordering weight of this block. Most modules do not provide an initial value, and any value provided can be modified by a user on the block configuration screen.
  • status: (optional) Initial value for block enabled status. (1 = enabled, 0 = disabled). Most modules do not provide an initial value, and any value provided can be modified by a user on the block configuration screen.
  • region: (optional) Initial value for theme region within which this block is set. Most modules do not provide an initial value, and any value provided can be modified by a user on the block configuration screen. Note: If you set a region that isn't available in the currently enabled theme, the block will be disabled.
  • 'pages': an array of menu paths where the block should appear. Example: array('admin', 'node/%/edit') will display the block on admin, admin/structure etc. and the node edit pages.
  • 'node_type': List of node types. The block will appear only on node/% pages with the specified node types.
1 function implements hook_block_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

mongodb_block_ui_block_info in mongodb_block_ui/mongodb_block_ui.module
Implements hook_block_info().
3 invocations of hook_block_info()
mongodb_block_ui_add_block_form_validate in mongodb_block_ui/mongodb_block_ui.admin.inc
Form validation handler for mongodb_block_ui_add_block_form.
mongodb_block_ui_admin_configure in mongodb_block_ui/mongodb_block_ui.admin.inc
Menu callback; displays the mongodb_block_ui configuration form.
_mongodb_block_rehash in mongodb_block/mongodb_block.module
Updates the block collection with the blocks currently exported by modules.

File

mongodb_block/mongodb_block.api.php, line 56
Hooks provided by the Block module.

Code

function hook_block_info() {
  $blocks['exciting'] = array(
    'info' => t('An exciting block provided by Mymodule.'),
    'weight' => 0,
    'status' => 1,
    'region' => 'sidebar_first',
  );
  $blocks['amazing'] = array(
    'info' => t('An amazing block provided by Mymodule.'),
    'cache' => DRUPAL_CACHE_PER_ROLE | DRUPAL_CACHE_PER_PAGE,
  );
  return $blocks;
}