-
Bug
-
Resolution: Fixed
-
Minor
-
2.5.2
-
MOODLE_25_STABLE
-
MOODLE_25_STABLE
-
MDL-42648_M26 -
As found in MDL-40971 Clean theme throws an exception if $PAGE->set_pagelayout() is changed after output is initialised.
Obviously in each particular case we should fix the call to set_pagelayout() like Mary did in MDL-40971.
But in the generic case since we don't show any warnings (they are commented out) inside the set_pagelayout() function, theme should be more tolerant to it as well. Standard-like themes have some php code inside layout files checking if block regions are not empty:
https://github.com/marinaglancy/moodle/blob/master/theme/base/layout/general.php#L6
Bootstrapbase/clean should do something similar. AFAIK samhemelryk was trying to avoid php code in layout files, maybe we can insert the check in renderer then?
diff --git a/lib/outputrenderers.php b/lib/outputrenderers.php
|
index 56b6f56..5a0bf27 100644
|
--- a/lib/outputrenderers.php
|
+++ b/lib/outputrenderers.php
|
@@ -3199,7 +3199,12 @@ EOD;
|
'data-blockregion' => $displayregion,
|
'data-droptarget' => '1'
|
);
|
- return html_writer::tag($tag, $this->blocks_for_region($region), $attributes);
|
+ if ($this->page->blocks->region_has_content($region, $this)) {
|
+ $content = $this->blocks_for_region($region);
|
+ } else {
|
+ $content = '';
|
+ }
|
+ return html_writer::tag($tag, $content, $attributes);
|
}
|
|
/**
|