mirror of
https://github.com/moodle/moodle.git
synced 2025-08-06 17:36:38 +02:00
MDL-53978 usertours: Swap to better callback
This commit is contained in:
parent
5ebd1fb976
commit
3e050643c7
2 changed files with 18 additions and 0 deletions
|
@ -44,6 +44,11 @@ class helper {
|
||||||
*/
|
*/
|
||||||
const MOVE_DOWN = 1;
|
const MOVE_DOWN = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var boolean Has it been bootstrapped?
|
||||||
|
*/
|
||||||
|
private static $bootstrapped = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the link to edit the step.
|
* Get the link to edit the step.
|
||||||
*
|
*
|
||||||
|
@ -488,6 +493,11 @@ class helper {
|
||||||
public static function bootstrap() {
|
public static function bootstrap() {
|
||||||
global $PAGE;
|
global $PAGE;
|
||||||
|
|
||||||
|
if (self::$bootstrapped) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
self::$bootstrapped = true;
|
||||||
|
|
||||||
if ($tour = manager::get_current_tour()) {
|
if ($tour = manager::get_current_tour()) {
|
||||||
$PAGE->requires->js_call_amd('tool_usertours/usertours', 'init', [
|
$PAGE->requires->js_call_amd('tool_usertours/usertours', 'init', [
|
||||||
$tour->get_id(),
|
$tour->get_id(),
|
||||||
|
|
|
@ -67,3 +67,11 @@ function tool_usertours_inplace_editable($itemtype, $itemid, $newvalue) {
|
||||||
function tool_usertours_extend_navigation_user() {
|
function tool_usertours_extend_navigation_user() {
|
||||||
\tool_usertours\helper::bootstrap();
|
\tool_usertours\helper::bootstrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add JS to bootstrap tours. Only in Moodle 3.3+
|
||||||
|
*/
|
||||||
|
function tool_usertours_before_footer() {
|
||||||
|
\tool_usertours\helper::bootstrap();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue