function _block_load_blocks

_block_load_blocks()

Loads blocks' information from the database.

Return value

An array of blocks grouped by region.

File

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

Code

function _block_load_blocks() {
  global $theme_key;

  $query = db_select('block', 'b');
  $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;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!block!block.module/function/_block_load_blocks/7.x