function block_block in Block Cache Alter 6
Same name in this branch
- 6 patches/block_with_node_grants.module \block_block()
- 6 patches/block_no_node_grants.module \block_block()
Implementation of hook_block().
Generates the administrator-defined blocks for display.
File
- patches/
block_with_node_grants.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;
}
}