function block_list

7.x block.module block_list($region)
6.x block.module block_list($region)

Returns all blocks in the specified region for the current user.

@todo Now that the block table has a primary key, we should use that as the array key instead of MODULE_DELTA.

Parameters

$region: The name of a region.

Return value

An array of block objects, indexed with the module name and block delta concatenated with an underscore, thus: MODULE_DELTA. 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.

1 call to block_list()
block_get_blocks_by_region in drupal-7.x/modules/block/block.module
Gets a renderable array of a region containing all enabled blocks.
2 string references to 'block_list'
block_page_build in drupal-7.x/modules/block/block.module
Implements hook_page_build().
_block_load_blocks in drupal-7.x/modules/block/block.module
Loads blocks' information from the database.

File

drupal-7.x/modules/block/block.module, line 674
Controls the visual building blocks a page is constructed with.

Code

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];
}