7.x block.module block_load($module, $delta)

Loads a block object from the database.

This function returns the first block matching the module and delta parameters, so it should not be used for theme-specific functionality.


$module: Name of the module that implements the block to load.

$delta: Unique ID of the block within the context of $module. Pass NULL to return an empty block object for $module.

Return value

A block object.

3 calls to block_load()
block_admin_configure in modules/block/block.admin.inc
Form constructor for the block configuration form.
block_custom_block_delete in modules/block/block.admin.inc
Form constructor for the custom block deletion form.
StatisticsReportsTestCase::testPopularContentBlock in modules/statistics/statistics.test
Tests the "popular content" block.
1 string reference to 'block_load'
_block_load_blocks in modules/block/block.module
Loads blocks' information from the database.


modules/block/block.module, line 714
Controls the visual building blocks a page is constructed with.


function block_load($module, $delta) {
  if (isset($delta)) {
    $block = db_query('SELECT * FROM {block} WHERE module = :module AND delta = :delta', array(':module' => $module, ':delta' => $delta))->fetchObject();

  // If the block does not exist in the database yet return a stub block
  // object.
  if (empty($block)) {
    $block = new stdClass();
    $block->module = $module;
    $block->delta = $delta;

  return $block;


CarlHinton’s picture

In Drupal 6 the following achieves a similar result:

$sql_object = db_query("SELECT * FROM {blocks} WHERE module = '%s' AND delta = '%s'", $module, $delta);
  $block = db_fetch_object($sql_object);?>