diff --git a/h5p/classes/player.php b/h5p/classes/player.php index a2f8564cea3..c1af5db6e57 100644 --- a/h5p/classes/player.php +++ b/h5p/classes/player.php @@ -154,7 +154,7 @@ class player { * Get the encoded URL for embeding this H5P content. * * @param string $url Local URL of the H5P file to display. - * @param stdClass $config Configuration for H5P buttons. + * @param \stdClass $config Configuration for H5P buttons. * @param bool $preventredirect Set to true in scripts that can not redirect (CLI, RSS feeds, etc.), throws exceptions * @param string $component optional moodle component to sent xAPI tracking * @param bool $displayedit Whether the edit button should be displayed below the H5P content. @@ -163,7 +163,8 @@ class player { * @return string The embedable code to display a H5P file. */ public static function display( - string $url, \stdClass $config, + string $url, + \stdClass $config, bool $preventredirect = true, string $component = '', bool $displayedit = false, @@ -193,7 +194,7 @@ class player { if ($originalfile) { // Check if the user can edit this content. if (api::can_edit_content($originalfile)) { - $template->editurl = $CFG->wwwroot . '/h5p/edit.php?url=' . $url; + $template->editurl = (new \moodle_url('/h5p/edit.php', ['url' => $url]))->out(false); } } }