mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
Merging MDL-8823 Made it so you can do require_js after header printed
This commit is contained in:
parent
edfda53d51
commit
787b30c0c2
1 changed files with 8 additions and 0 deletions
|
@ -35,6 +35,14 @@ function require_js($lib='') {
|
||||||
$libpath = ajax_get_lib($lib);
|
$libpath = ajax_get_lib($lib);
|
||||||
if (array_search($libpath, $loadlibs) === false) {
|
if (array_search($libpath, $loadlibs) === false) {
|
||||||
$loadlibs[] = $libpath;
|
$loadlibs[] = $libpath;
|
||||||
|
// If this is called after header, then we print it right away
|
||||||
|
// as otherwise nothing will ever happen!
|
||||||
|
if (defined('HEADER_PRINTED')) {
|
||||||
|
$realloadlibs=$loadlibs;
|
||||||
|
$loadlibs=array($libpath);
|
||||||
|
print require_js();
|
||||||
|
$loadlibs=$realloadlibs;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue