Skip to content

Commit

Permalink
MDL-71955 h5p: ensure embedded player sets up $PAGE correctly.
Browse files Browse the repository at this point in the history
For module context, it should set the current cm and course to
ensure consistency in navigation API.
  • Loading branch information
paulholden committed Sep 11, 2023
1 parent b4c6ed3 commit 26f7eda
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion h5p/embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,15 @@

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());

Expand Down

0 comments on commit 26f7eda

Please sign in to comment.