function _regions_blocks in Regions 6
Same name and namespace in other branches
- 7 regions.module \_regions_blocks()
Helper function to get a list of blocks per region, as provided by core block and context modules.
Parameters
string $region_name: The region identifier.
array $region_info: An individual element child of the array returned by _regions_list().
Return value
A string containing the rendered blocks for this region.
See also
1 call to _regions_blocks()
- regions_footer in ./
regions.module - Implementation of hook_footer().
File
- ./
regions.module, line 161 - Add regions to the screen that are cross-theme compliant
Code
function _regions_blocks($region_name, $region_info) {
// Update the {blocks} table with the blocks currently exported by modules.
_block_rehash();
$blocks = array();
if (module_exists('context') && function_exists('context_get_plugin')) {
$blocks = context_get_plugin('reaction', 'block')
->block_list($region_name);
}
else {
$blocks = block_list($region_name);
}
// Allow other modules to alter the blocks array before the each block object
// is rendered by theme_block().
drupal_alter('regions_blocks', $blocks, $region_name);
// Render the array of blocks using either an optional module-provided
// callback, or the default theme('block', $block).
$render_callback = isset($region_info['render_callback']) && function_exists($region_info['render_callback']) ? $region_info['render_callback'] : 'theme';
$output = '';
foreach ($blocks as $block) {
$output .= call_user_func_array($render_callback, array(
'block',
$block,
));
}
return $output;
}