block_list
- Versions
- 4.6
block_list($region,$regions= array('left' => 0, 'right' => 1, 'all' => '0, 1'))- 4.7 – 7
block_list($region)
Return all blocks in the specified region for the current user.
@todo Now that the blocks table has a primary key, we should use that as the array key instead of <i>module</i>_<i>delta</i>.
Parameters
$region The name of a region.
Return value
An array of block objects, indexed with <i>module</i>_<i>delta</i>. If you are displaying your blocks in one or two sidebars, you may check whether this array is empty to see how many columns are going to be displayed.
Code
modules/block/block.module, line 576
<?php
function block_list($region) {
$blocks = &drupal_static(__FUNCTION__);
if (!isset($blocks)) {
$blocks = _block_load_blocks();
}
// Create an empty array if there are no entries.
if (!isset($blocks[$region])) {
$blocks[$region] = array();
}
else {
$blocks[$region] = _block_render_blocks($blocks[$region]);
}
return $blocks[$region];
}
?>Login or register to post comments 