function block_load
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.
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.
File
- modules/block/block.module, line 715
- Controls the visual building blocks a page is constructed with.
Code
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; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!block!block.module/function/block_load/7.x