I have an alternative main menu that is used on specific node types. When turning on the cache the menu block is cached. The theme suggestion for the menu is then ignored.
I tried to disable the menu cache by changing the block preprocess cache settings. But the menu block is not called when using hook_preprocess_block.
Also I tried to change the menu / block by using the hook_page_preprocess
function bootstrap_custom_preprocess_page(&$variables) {
//disable caches for every top header element
//we do this as the dynamic header menu can't be cached - because of the landing page node type
if(key_exists('top_header', $variables['page'])){
foreach ($variables['page']['top_header'] as $key => $value){
if(substr($key, 0, 1) !== '#'){
$value['#cache']['max-age'] = 0;
}
}
}
}
No success.