When using Panels, disabling blocks via "Disable Drupal blocks/regions" checkbox on a variant's "General" settings, doesn't hide blocks and they appear in the middle column on a page.
This is how the problem occurs.
Block hiding is performed by CTools. In ctools_block_list_alter() it checks ctools_set_no_blocks drupal static variable, and if its TRUE, it removes "bad" blocks from block list. This variable is initialized in ctools_context_handler_render_handler() after calling a renderer:
function ctools_context_handler_render_handler(...) {
$function = page_manager_get_renderer($handler);
...
$info = $function($handler, $contexts, $args);
...
// Only directly output if $page was set to true.
if (!empty($info['no_blocks'])) {
ctools_set_no_blocks(FALSE);
}
So if a renderer would call block_list(), "bad" blocks won't be removed (since ctools_set_no_blocks is not initialized). And that is exactly what happens in Fusion.
It calls block_list() from fusion_core_block_list() which is called for the first time from:
fusion_core_preprocess_node()- to fill up node_regions with blocks,
if there are nodes on a page.
Another time fusion_core_block_list() is called by Fusion from:
fusion_core_preprocess_page()- to get appearance info for $grid's sidebars.
but this time, "bad" blocks are removed from the block list.
There are two ways to fix this problem:
- In CTools by moving ctools_set_no_blocks initialization before calling a renderer,
- In Fusion by not calling block_list() at all. I don't know however how node regions would work then.
Giving this a "bug" status, since initializing block_list from node preprocess looks strange.
Comments
Comment #0.0
OnkelTem commentedUpdated issue summary.
Comment #0.1
OnkelTem commentedUpdated issue summary.
Comment #1
Poieo commentedMarking this as a duplicate of #1172280: Fusion themes render blocks twice since that issue should fix this one.
Comment #2
CaptShmo commentedMore info about this issue (D7) here:
https://www.drupal.org/node/1349328