function block_block in Drupal 4
Same name and namespace in other branches
- 5 modules/block/block.module \block_block()
- 6 modules/block/block.module \block_block()
Implementation of hook_block().
Generates the administrator-defined blocks for display.
File
- modules/
block.module, line 106 - 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, title, info FROM {boxes} ORDER BY title');
while ($block = db_fetch_object($result)) {
$blocks[$block->bid]['info'] = $block->info ? check_plain($block->info) : check_plain($block->title);
}
return $blocks;
case 'configure':
$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 * FROM {boxes} WHERE bid = %d', $delta));
$data['subject'] = check_plain($block->title);
$data['content'] = check_markup($block->body, $block->format, FALSE);
return $data;
}
}