From dd75c98889a1547d39fea93e014e07d3f32bfaf6 Mon Sep 17 00:00:00 2001 From: Ferran Recio Date: Fri, 5 Jun 2020 08:31:00 +0200 Subject: [PATCH] MDL-68826 mod_h5pactivity: fix content bank link --- mod/h5pactivity/mod_form.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mod/h5pactivity/mod_form.php b/mod/h5pactivity/mod_form.php index bb5227ad217..40e17dd452b 100644 --- a/mod/h5pactivity/mod_form.php +++ b/mod/h5pactivity/mod_form.php @@ -74,8 +74,10 @@ class mod_h5pactivity_mod_form extends moodleform_mod { $mform->addHelpButton('packagefile', 'package', 'mod_h5pactivity'); // Add a link to the Content Bank if the user can access. - if (has_capability('moodle/contentbank:access', $this->context)) { - $url = new moodle_url('/contentbank/index.php', ['contextid' => $this->context->id]); + $course = $this->get_course(); + $context = context_course::instance($course->id); + if (has_capability('moodle/contentbank:access', $context)) { + $url = new moodle_url('/contentbank/index.php', ['contextid' => $context->id]); $msg = get_string('usecontentbank', 'mod_h5pactivity', $url->out()); $msg .= ' '.$OUTPUT->help_icon('contentbank', 'mod_h5pactivity'); $mform->addElement('static', 'contentbank', '', $msg);