MDL-53978 usertours: Swap to better callback
This commit is contained in:
@@ -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(),
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user