You can use hook_page_alterhook_preprocess_html(). For example, toito remove the system navigation block from the "sidebar_first" region, define the following hook in your MODULE.module: ` function MYMODULE_page_alter(&$page) { if ($my_condition) { $region_name = 'sidebar_first'; $block_name = 'system_navigation';
iffunction (issetMODULE_preprocess_html($page[$region_name][$block_name])&$variables) {
$page[$region_name][$block_name]['#access']if($variables['page']['REGION']['BLOCK'])
$variables['page']['REGION']['BLOCK']['#access'] = FALSE;
}
} } ` with REGION = sidebar_first and BLOCK = system_navigation.