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:
+9
-1
@@ -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());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user