diff --git a/plugins/content_types/block/block.inc b/plugins/content_types/block/block.inc index 4d4c31c..a3f66cb 100644 --- a/plugins/content_types/block/block.inc +++ b/plugins/content_types/block/block.inc @@ -90,26 +90,46 @@ function _ctools_block_content_type_content_type($module, $delta, $block) { * doesn't cache its results anyway. */ 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(); + if (module_exists('block')) { + $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'); + } + + else { + $block_info = array(); + foreach (module_implements('block_info') as $module) { + foreach (module_invoke($module, 'block_info') as $delta => $block) { + $block_info[] = (object) array( + 'module' => $module, + 'delta' => $delta, + 'theme' => $theme_key, + 'status' => 0, + 'weight' => 0, + 'region' => -1, + 'custom' => 0, + 'visibility' => 0, + 'pages' => NULL, + 'title' => NULL, + 'cache' => isset($block['cache']) ? $block['cache'] : 0, + ); + } + } + } - $block_info = $result->fetchAllAssoc('bid'); // Allow modules to modify the block list. drupal_alter('block_list', $block_info);