function _block_load_blocks

Loads blocks' information from the database.

Return value

An array of blocks grouped by region.

1 call to _block_load_blocks()
block_list in drupal/core/modules/block/block.module
Returns all blocks in the specified region for the current user.

File

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

Code

function _block_load_blocks() {
  global $theme_key;
  $query = db_select('block', 'b');
  $query
    ->addField('b', 'title', 'subject');
  $result = $query
    ->fields('b')
    ->condition('b.theme', $theme_key)
    ->condition('b.status', 1)
    ->orderBy('b.region')
    ->orderBy('b.weight')
    ->orderBy('b.module')
    ->addTag('block_load')
    ->addTag('translatable')
    ->execute();
  $block_info = $result
    ->fetchAllAssoc('bid');

  // Allow modules to modify the block list.
  drupal_alter('block_list', $block_info);
  $blocks = array();
  foreach ($block_info as $block) {
    $blocks[$block->region]["{$block->module}_{$block->delta}"] = $block;
  }
  return $blocks;
}