From b4c91012d40c3c955308fd4f91d624b6ac9a789a Mon Sep 17 00:00:00 2001 From: Sam Hemelryk Date: Fri, 15 Oct 2010 02:04:17 +0000 Subject: [PATCH] output MDL-24683 Fixed up premature initialisation of theme and output through the admin structure. --- admin/settings/plugins.php | 7 ++++++- lib/pagelib.php | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/admin/settings/plugins.php b/admin/settings/plugins.php index 14c6dd2ec74..6eb2d152352 100644 --- a/admin/settings/plugins.php +++ b/admin/settings/plugins.php @@ -331,7 +331,12 @@ if ($hassiteconfig) { if (empty($CFG->enablewebservices)) { $temp->add(new admin_setting_heading('webservicesaredisabled', '', get_string('disabledwarning', 'webservice'))); } - $wsdoclink = $OUTPUT->doc_link('How_to_get_a_security_key'); + + // We cannot use $OUTPUT this early, doing so means that we lose the ability + // to set the page layout on all admin pages. + // $wsdoclink = $OUTPUT->doc_link('How_to_get_a_security_key'); + $url = new moodle_url(get_docs_url('How_to_get_a_security_key')); + $wsdoclink = html_writer::tag('a', get_string('supplyinfo'),array('href'=>$url)); $temp->add(new admin_setting_configcheckbox('enablewsdocumentation', get_string('enablewsdocumentation', 'admin'), get_string('configenablewsdocumentation', 'admin', $wsdoclink), false)); $ADMIN->add('webservicesettings', $temp); diff --git a/lib/pagelib.php b/lib/pagelib.php index e80c8f94e99..bd1ff1f63ed 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -1203,6 +1203,11 @@ class moodle_page { public function initialise_theme_and_output() { global $OUTPUT, $PAGE, $SITE; + // If you have lost all blocks on a page and cannot work out why + // try uncommenting this this debugging line and seeing what you get. + // Chances are the theme and output are being initialised prematurely. + // debugging('Initialising theme and output with layout '.$this->_pagelayout, DEBUG_DEVELOPER); + if (!empty($this->_wherethemewasinitialised)) { return; }