function advanced_menu_blocks_block_info_alter in Advanced Menu 7
Implements hook_block_info_alter().
File
- blocks/
advanced_menu_blocks.module, line 24 - Provides block customization settings for menus.
Code
function advanced_menu_blocks_block_info_alter(&$blocks, $theme, $code_blocks) {
//System menus are checked first.
$system_menus = array(
'navigation',
'management',
'user-menu',
'main-menu',
);
foreach ($system_menus as $sys_menu) {
if (_advanced_menu_blocks_disabled($sys_menu) == array(
1,
)) {
unset($blocks['system'][$sys_menu]);
db_delete('block')
->condition('module', 'system')
->condition('delta', $sys_menu)
->condition('theme', $theme)
->execute();
}
}
//Loop through the custom menus
foreach ($blocks['menu'] as $menu => $value) {
if (_advanced_menu_blocks_disabled($menu) == array(
1,
)) {
unset($blocks['menu'][$menu]);
db_delete('block')
->condition('module', 'menu')
->condition('delta', $menu)
->condition('theme', $theme)
->execute();
}
}
if (empty($blocks['menu'])) {
unset($blocks['menu']);
}
}