diff --git a/blockcache_alter.module b/blockcache_alter.module index f9cb113..ec42eb6 100644 --- a/blockcache_alter.module +++ b/blockcache_alter.module @@ -131,8 +131,9 @@ function blockcache_alter_block_view_alter(&$data, $block) { // This can only apply to blocks that are render arrays. if (isset($data['content']) && is_array($data['content'])) { $blockcache_alter = blockcache_alter_load_cache_configurations(); - if (isset($blockcache_alter[$block->bid])) { - $block->cache = $blockcache_alter[$block->bid]->cache; + $fake_bid = $block->module . '-' . $block->delta . '-' . $block->theme; + if (isset($blockcache_alter[$fake_bid])) { + $block->cache = $blockcache_alter[$fake_bid]->cache; } // Set the block render array to cache based on our settings. @@ -157,14 +158,17 @@ function blockcache_alter_load_cache_configurations() { $blockcache_alter = &drupal_static(__FUNCTION__, FALSE); if ($blockcache_alter === FALSE) { - $results = db_select('blockcache_alter', 'b') - ->fields('b') - ->execute() + $blockcache_alter = array(); + $results = db_select('blockcache_alter', 'bca') + ->fields('bca'); + $results->join('block', 'b', 'bca.bid = %alias.bid'); + $results->fields('b', array('theme')); + $results = $results->execute() ->fetchAll(); - $blockcache_alter = array(); foreach ($results as $block) { - $blockcache_alter[$block->module . '-' . $block->delta] = $block; + $fake_bid = $block->module . '-' . $block->delta . '-' . $block->theme; + $blockcache_alter[$fake_bid] = $block; } }