feat: Add dynamic script integration for exp360 module
Introduced a dynamic content management function to enhance the exp360 module's capabilities. This function injects necessary scripts dynamically, improving the modularity and maintainability of the exp360 activities. By adding Bootstrap dependencies and specific scripts directly into the content management info, the changes ensure that the module leverages required resources efficiently.
This commit is contained in:
parent
3247092e59
commit
3a08f0e564
1 changed files with 14 additions and 0 deletions
14
lib.php
14
lib.php
|
@ -42,3 +42,17 @@ function exp360_delete_instance($id)
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
function mod_exp360_cm_info_dynamic(cm_info $cm)
|
||||
{
|
||||
global $PAGE, $DB;
|
||||
|
||||
if ($cm->modname !== 'exp360') {
|
||||
return;
|
||||
}
|
||||
|
||||
$script = "<script src='https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js'></script><script data-activity-id='$cm->id' src='/mod/exp360/script.js'></script>";
|
||||
|
||||
$cm->set_no_view_link();
|
||||
$cm->set_content($script);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue