Skip to content

Commit

Permalink
MDL-58744 blocks: Add system context block position in non user context.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacac committed Jul 27, 2017
1 parent eb560d0 commit c2de62b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/blocklib.php
Expand Up @@ -728,6 +728,8 @@ public function load_blocks($includeinvisible = null) {
$ccjoin = "LEFT JOIN {context} ctx ON (ctx.instanceid = bi.id AND ctx.contextlevel = :contextlevel)";

$systemcontext = context_system::instance();
list($bpcontext, $bpcontextidparams) = $DB->get_in_or_equal(array($context->id, $systemcontext->id),
SQL_PARAMS_NAMED, 'bpcontextid');
$params = array(
'contextlevel' => CONTEXT_BLOCK,
'subpage1' => $this->page->subpage,
Expand Down Expand Up @@ -761,7 +763,7 @@ public function load_blocks($includeinvisible = null) {
FROM {block_instances} bi
JOIN {block} b ON bi.blockname = b.name
LEFT JOIN {block_positions} bp ON bp.blockinstanceid = bi.id
AND bp.contextid = :contextid1
AND bp.contextid $bpcontext
AND bp.pagetype = :pagetype
AND bp.subpage = :subpage1
$ccjoin
Expand All @@ -779,7 +781,8 @@ public function load_blocks($includeinvisible = null) {
COALESCE(bp.weight, bi.defaultweight),
bi.id";

$allparams = $params + $parentcontextparams + $pagetypepatternparams + $requiredbythemeparams + $requiredbythemenotparams;
$allparams = $params + $parentcontextparams + $pagetypepatternparams + $requiredbythemeparams;
$allparams = $allparams + $requiredbythemenotparams + $bpcontextidparams;
$blockinstances = $DB->get_recordset_sql($sql, $allparams);

$this->birecordsbyregion = $this->prepare_per_region_arrays();
Expand Down

0 comments on commit c2de62b

Please sign in to comment.