From e9324a2274bf02aa4281e5d96e5eeb596ebbf86e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20S=CC=8Ckoda?= Date: Sun, 22 Jul 2012 15:26:15 +0200 Subject: [PATCH] MDL-34449 lazy load theme layout otpions This should allow us to switch page layout on admin pages and elsewhere before $OUTPUT->header() call. --- lib/pagelib.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/pagelib.php b/lib/pagelib.php index ddea0391306..602331476b2 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -186,7 +186,7 @@ class moodle_page { * @var array List of theme layout options, these are ignored by core. * To be used in individual theme layout files only. */ - protected $_layout_options = array(); + protected $_layout_options = null; /** * @var string An optional arbitrary parameter that can be set on pages where the context @@ -496,6 +496,9 @@ class moodle_page { * @return array returns arrys with options for layout file */ protected function magic_get_layout_options() { + if (!is_array($this->_layout_options)) { + $this->_layout_options = $this->_theme->pagelayout_options($this->pagelayout); + } return $this->_layout_options; } @@ -1433,7 +1436,6 @@ class moodle_page { if (is_null($this->_theme)) { $themename = $this->resolve_theme(); $this->_theme = theme_config::load($themename); - $this->_layout_options = $this->_theme->pagelayout_options($this->pagelayout); } $this->_theme->setup_blocks($this->pagelayout, $this->blocks);