MDL-53978 usertours: Swap to better callback

This commit is contained in:
Brendan Heywood 2017-01-18 15:33:31 +11:00
parent 5ebd1fb976
commit 3e050643c7
2 changed files with 18 additions and 0 deletions

View file

@ -44,6 +44,11 @@ class helper {
*/
const MOVE_DOWN = 1;
/**
* @var boolean Has it been bootstrapped?
*/
private static $bootstrapped = false;
/**
* Get the link to edit the step.
*
@ -488,6 +493,11 @@ class helper {
public static function bootstrap() {
global $PAGE;
if (self::$bootstrapped) {
return;
}
self::$bootstrapped = true;
if ($tour = manager::get_current_tour()) {
$PAGE->requires->js_call_amd('tool_usertours/usertours', 'init', [
$tour->get_id(),

View file

@ -67,3 +67,11 @@ function tool_usertours_inplace_editable($itemtype, $itemid, $newvalue) {
function tool_usertours_extend_navigation_user() {
\tool_usertours\helper::bootstrap();
}
/**
* Add JS to bootstrap tours. Only in Moodle 3.3+
*/
function tool_usertours_before_footer() {
\tool_usertours\helper::bootstrap();
}