If you set Disable Drupal blocks/regions on a panel or panelized page, sidebars with blocks added through context still get rendered. Ctools implements this feature like this:
/**
* Implement hook_block_list_alter() to potentially remove blocks.
*
* This exists in order to replicate Drupal 6's "no blocks" functionality.
*/
function ctools_block_list_alter(&$blocks) {
$check = drupal_static('ctools_set_no_blocks', TRUE);
if (!$check) {
foreach ($blocks as $block_id => $block) {
// @todo -- possibly we can set configuration for this so that users can
// specify which blocks will not get rendered.
if (strpos($block->region, 'sidebar') !== FALSE) {
unset($blocks[$block_id]);
}
}
}
}
Not quite sure why, by it's no taking effect with Omega/Context.
Comments
Comment #1
mrfelton commentedActually, I think this is a panels / context issue, and the fix should be in panels. Currently uses hook_block_list_alter() in order to remove blocks from regions. But the block system isn't the only way to add blocks to regions. Think Context.
Attached patch also implements hook_page_alter() to do the same, which is the same way that Context's region reaction works.
With this implementation, I'm not sure if hook_block_list_alter() is still needed, but I have left it in place.
Comment #1.0
mrfelton commentedFix embedded code issue.
Comment #2
Renee S commentedThis patch worked for me with Omega/Panelizer. Thanks.
Comment #2.0
Renee S commentedAdd better description
Comment #3
stella commentedPatch in #1 works for me.
Comment #4
wonder95 commentedPatch in #1 resolved issue for me as well.
Comment #5
andrewmacpherson commentedPatch in #1 no longer applies against latest dev, re-rolling.
This patch applies against latest release (7.x-1.4) and latest dev (7.x-1.4+4-dev)
Comment #6
andrewmacpherson commentedComment #7
bc commentedpatch in #5 works for me using context-7.x-3.3, panels-7.x-3.4, and bootstrap theme.
Comment #8
yanniboi commentedYep the patch above works well. I was tempted to wrap it in a module_exists('context') if statement, but considering that other modules than context might add blocks to the page lets leave that out.
Comment #10
mrjmd commentedComment #11
japerryWorks good. Fixed!