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

mrfelton’s picture

Title: Omega should honor Panel's 'Disable Drupal blocks/regions' setting » 'Disable Drupal blocks/regions' setting doesn't work when blocks are placed into regions with systems other than core blocks.
Project: Omega » Chaos Tool Suite (ctools)
Version: 7.x-3.x-dev » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new1.16 KB

Actually, 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.

mrfelton’s picture

Issue summary: View changes

Fix embedded code issue.

Renee S’s picture

This patch worked for me with Omega/Panelizer. Thanks.

Renee S’s picture

Issue summary: View changes

Add better description

stella’s picture

Patch in #1 works for me.

wonder95’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Patch in #1 resolved issue for me as well.

andrewmacpherson’s picture

Patch 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)

andrewmacpherson’s picture

Status: Reviewed & tested by the community » Needs review
bc’s picture

patch in #5 works for me using context-7.x-3.3, panels-7.x-3.4, and bootstrap theme.

yanniboi’s picture

Status: Needs review » Reviewed & tested by the community

Yep 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.

mrjmd’s picture

japerry’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +SprintWeekend2015

Works good. Fixed!

  • japerry committed 3d2db7a on 7.x-1.x authored by mrfelton
    Issue #1652060 by mrfelton, andrewmacpherson: 'Disable Drupal blocks/...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.