diff --git a/filter/displayh5p/filter.php b/filter/displayh5p/filter.php index f693b3c035b..9d38d2ea073 100644 --- a/filter/displayh5p/filter.php +++ b/filter/displayh5p/filter.php @@ -49,7 +49,7 @@ class filter_displayh5p extends moodle_text_filter { * @return string */ public function filter($text, array $options = array()) { - global $CFG; + global $CFG, $USER; if (!is_string($text) or empty($text)) { // Non string data can not be filtered anyway. @@ -83,7 +83,10 @@ class filter_displayh5p extends moodle_text_filter { // It is needed to add "/embed" at the end of URLs like https:://*.h5p.com/content/12345 (H5P.com). $params['urlmodifier'] = ''; - if (($source == $localsource)) { + // Local files may display a button below the content to modify it when editing mode is on. This button will appear + // only if the user has the proper capabilities. + $params['canbeedited'] = (!empty($USER->editing)) && ($source == $localsource); + if ($source == $localsource) { $params['tagbegin'] = '