You are here

function blockcache_alter_block_info_alter in Block Cache Alter 7

Implementation of hook_block_info_alter().

File

./blockcache_alter.module, line 281
Block cache alter module.

Code

function blockcache_alter_block_info_alter(&$blocks, $theme, $code_blocks) {
  try {
    $blockcache_alter = db_select('blockcache_alter', 'b')
      ->fields('b', array(
      'bid',
      'module',
      'cache',
    ))
      ->execute()
      ->fetchAll();
  } catch (PDOException $e) {
    $blockcache_alter = array();
    watchdog('blockcache alter', 'Block cache alter was unable to load block cache data. You may need to run updates.', array(), WATCHDOG_ERROR);
  }
  foreach ($blockcache_alter as $bca) {
    if (array_key_exists($bca->module, $blocks)) {
      foreach ($blocks[$bca->module] as $key => $module) {
        if (isset($module['bid']) && $module['bid'] == $bca->bid) {
          $blocks[$bca->module][$key]['cache'] = $bca->cache;
        }
      }
    }
  }
}