function colorized_gmap_block_info_alter in Colorized google maps block 7
Implements hook_block_info_alter().
File
- ./
colorized_gmap.module, line 80 - Colorized gmap module.
Code
function colorized_gmap_block_info_alter(&$blocks, $theme, $code_blocks) {
// @todo: Just use then blocks imported via features.
// There is a strange behavior with _block_rehash().
// After enabling feature, _block_rehash() is called and
// set the same region for each enabled themes.
// Below code just set true region values (from block entity).
// Cannot figure out how to fix it correctly.
if (module_exists('features') && isset($blocks['colorized_gmap'])) {
$ids = array_keys($blocks['colorized_gmap']);
$entities = entity_load('colorized_gmap', $ids);
foreach ($entities as $key => $item) {
if (isset($item->block_settings['region'][$theme])) {
$blocks['colorized_gmap'][$key]['region'] = $item->block_settings['region'][$theme];
}
else {
$blocks['colorized_gmap'][$key]['region'] = -1;
}
}
}
}