diff --git a/h5p/embed.php b/h5p/embed.php index 779b3256ce933..c2ff803d29210 100644 --- a/h5p/embed.php +++ b/h5p/embed.php @@ -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());