/**
* Implementation of hook_block().
*/
function _report_block($op = 'list', $delta = 0, $edit = array()) {
if ($op == 'list') {
$blocks['custom_block'] = array(
'info' => t('My custom block'),
'weight' => 0,
'status' => 1,
'cache' => BLOCK_CACHE_PER_ROLE | BLOCK_CACHE_PER_PAGE,
);
return $blocks;
}
else if ($op == 'view') {
switch($delta){
case 'custom_block':
$data['subject'] = t('Enjoy your life :)');
$data['content'] = my_block_content();
return $data;
break;
}
}
}
function my_block_content(){
$blocks = array('block_1', 'block_2', 'block_3');
$items = array();
$view = views_get_view('my_view');
foreach($blocks AS $block){
$view->set_display($block);
$view->execute();
$items[] = $view->result;
}
shuffle($items);
return $items;
}