reli
12/12/2013 - 2:27 PM

Blocks block render

Blocks block render

<?php 
Printing the blocks

/* Print custom block content */
$block = module_invoke('block','block_view','1');
print render($block['content']);
 
/* Print the whole custom block (with divs, title etc.) */
$block = block_load('block','1');
print drupal_render(_block_get_renderable_array(_block_render_blocks(array($block))));
 
/* Print a views block */
$block = module_invoke('views','block_view','print_block_test_view-block');
print render($block);


?>

/*
Parameters for the functions:
module_invoke($module,$hook,$delta):
block_load($module,$delta)

$module = module name (like block or views)
$hook = hook inside the module to invoke (like block_view)
$delta = identifier of the block (like test_view-block or 1)

You can find the right module and delta name for the block when hovering configure link in blocks page in  #overlay=admin/structure/block

Example:
#overlay=admin/structure/block/manage/block/1/configure
#overlay=admin/structure/block/manage/views/test_view-block/configure
*/