function block_block in Drupal 6
Same name and namespace in other branches
- 4 modules/block.module \block_block()
- 5 modules/block/block.module \block_block()
Implementation of hook_block().
Generates the administrator-defined blocks for display.
File
- modules/
block/ block.module, line 189 - Controls the boxes that are displayed around the main content.
Code
function block_block($op = 'list', $delta = 0, $edit = array()) {
switch ($op) {
case 'list':
$blocks = array();
$result = db_query('SELECT bid, info FROM {boxes} ORDER BY info');
while ($block = db_fetch_object($result)) {
$blocks[$block->bid]['info'] = $block->info;
// Not worth caching.
$blocks[$block->bid]['cache'] = BLOCK_NO_CACHE;
}
return $blocks;
case 'configure':
$box = array(
'format' => FILTER_FORMAT_DEFAULT,
);
if ($delta) {
$box = block_box_get($delta);
}
if (filter_access($box['format'])) {
return block_box_form($box);
}
break;
case 'save':
block_box_save($edit, $delta);
break;
case 'view':
$block = db_fetch_object(db_query('SELECT body, format FROM {boxes} WHERE bid = %d', $delta));
$data['content'] = check_markup($block->body, $block->format, FALSE);
return $data;
}
}