MDL-38507 JavaScript: Move definition of YUI_config before setup of SimpleYUI

Since moving to SimpleYUI, the order of inclusion for the YUI_config
variable is more important.

Simple YUI defines a global instance of YUI so that it can be used without
specifying the full YUI().use() syntax. As a result, any configuration
applied when that global instance is setup must exist already.
This commit is contained in:
Andrew Robert Nicols 2013-03-16 12:57:15 +00:00
parent b3c78403b0
commit 43bd811891

View File

@ -1049,11 +1049,7 @@ class page_requirements_manager {
// create circular references in memory which prevents garbage collection.
$this->init_requirements_data($page, $renderer);
// YUI3 JS and CSS is always loaded first - it is cached in browser.
$output = $this->get_yui3lib_headcode($page);
// Now theme CSS + custom CSS in this specific order.
$output .= $this->get_css_code();
$output = '';
// Set up global YUI3 loader object - this should contain all code needed by plugins.
// Note: in JavaScript just use "YUI().use('overlay', function(Y) { .... });",
@ -1067,6 +1063,13 @@ class page_requirements_manager {
$js = $this->YUI_config->update_header_js($js);
$output .= html_writer::script($js);
// YUI3 JS and CSS need to be loaded in the header but after the YUI_config has been created.
// They should be cached well by the browser.
$output .= $this->get_yui3lib_headcode($page);
// Now theme CSS + custom CSS in this specific order.
$output .= $this->get_css_code();
// Link our main JS file, all core stuff should be there.
$output .= html_writer::script('', $this->js_fix_url('/lib/javascript-static.js'));