function _ctools_block_load_blocks

Load block info from the database.

This is copied from _block_load_blocks(). It doesn't use that function because _block_load_blocks sorts by region, and it doesn't cache its results anyway.

1 call to _ctools_block_load_blocks()
_ctools_get_block_info in plugins/content_types/block/block.inc
Fetch the stored info for a block.

File

plugins/content_types/block/block.inc, line 92

Code

function _ctools_block_load_blocks() {
    if (!module_exists('block')) {
        return array();
    }
    $blocks =& drupal_static(__FUNCTION__, NULL);
    if (!isset($blocks)) {
        global $theme_key;
        $query = db_select('block', 'b');
        $result = $query->fields('b')
            ->condition('b.theme', $theme_key)
            ->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->module}_{$block->delta}"] = $block;
        }
    }
    return $blocks;
}