block_load

Versions
7
block_load($module, $delta)

Load a block object from the database.

Parameters

$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.

▾ 2 functions call block_load()

block_admin_configure in modules/block/block.admin.inc
Menu callback; displays the block configuration form.
block_custom_block_delete in modules/block/block.admin.inc
Menu callback; confirm deletion of custom blocks.

Code

modules/block/block.module, line 582

<?php
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;
}
?>
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.