The Context sets empty regions to empty arrays in context_page_build. This can confuse themes/modules that use isset to test for empty regions in hook_preprocess_html's $vars for example.
The patch below adjusts the code to only set the region if context has blocks to place in the region. (I'll attach the below as a patch file in the first comment).
// Load all region content assigned via blocks.
foreach (array_keys($all_regions) as $region) {
if ($this->is_enabled_region($region)) {
- $page[$region] = isset($page[$region]) ? array_merge($page[$region], $this->block_get_blocks_by_region($region)) : $this->block_get_blocks_by_region($region);
+ if ($blocks = $this->block_get_blocks_by_region($region)) {
+ $page[$region] = isset($page[$region]) ? array_merge($page[$region], $blocks) : $blocks;
+ }
}
}
}
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | context-empty-regions-1100610-1.patch | 760 bytes | setvik |
Comments
Comment #1
setvik commentedComment #2
setvik commentedComment #3
jwolf commentedHere is an example of a theme's implementation of html preprocess function which is using isset that causes this issue:
Comment #4
setvik commentedComment #5
setvik commentedComment #6
febbraro commentedThanks.
http://drupalcode.org/project/context.git/commit/a1771c0