function block_list

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

Parameters

$region: The name of a region.

Return value

An array of block objects, indexed with the configuration object name that represents the configuration. 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/core/modules/block/block.module
Gets a renderable array of a region containing all enabled blocks.
1 string reference to 'block_list'
block_page_build in drupal/core/modules/block/block.module
Implements hook_page_build().

File

drupal/core/modules/block/block.module, line 448
Controls the visual building blocks a page is constructed with.

Code

function block_list($region) {
  $blocks =& drupal_static(__FUNCTION__);
  if (!isset($blocks)) {
    global $theme;
    $blocks = array();
    foreach (entity_load_multiple_by_properties('block', array(
      'theme' => $theme,
    )) as $block_id => $block) {
      $blocks[$block
        ->get('region')][$block_id] = $block;
    }
  }

  // Create an empty array if there are no entries.
  if (!isset($blocks[$region])) {
    $blocks[$region] = array();
  }
  return $blocks[$region];
}