MDL-71955 h5p: ensure embedded player sets up $PAGE correctly.

For module context, it should set the current cm and course to
ensure consistency in navigation API.
This commit is contained in:
Paul Holden
2023-09-11 10:18:17 +01:00
parent f1116b10f1
commit da8fc7640d
+9 -1
View File
@@ -51,7 +51,15 @@ try {
if (empty($messages->error) && empty($messages->exception)) {
// Configure page.
$PAGE->set_context($h5pplayer->get_context());
$context = $h5pplayer->get_context();
if ($context instanceof context_module) {
[$course, $cm] = get_course_and_cm_from_cmid($context->instanceid);
$PAGE->set_cm($cm, $course);
$PAGE->activityheader->disable();
} else {
$PAGE->set_context($context);
}
$PAGE->set_title($h5pplayer->get_title());
$PAGE->set_heading($h5pplayer->get_title());