MDL-66399 editor: Only set h5p settings if user can deploy

This commit is contained in:
Andrew Nicols 2019-11-05 14:19:08 +08:00
parent e943e7d56f
commit 408eb5e0d9

View file

@ -390,6 +390,8 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element implements templatab
$subtitle_options->env = 'editor'; $subtitle_options->env = 'editor';
$subtitle_options->itemid = $draftitemid; $subtitle_options->itemid = $draftitemid;
if (has_capability('moodle/h5p:deploy', $ctx)) {
// Only set H5P Plugin settings if the user can deploy new H5P content.
// H5P plugin. // H5P plugin.
$args->accepted_types = array('.h5p'); $args->accepted_types = array('.h5p');
$h5poptions = initialise_filepicker($args); $h5poptions = initialise_filepicker($args);
@ -399,12 +401,13 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element implements templatab
$h5poptions->areamaxbytes = $this->_options['areamaxbytes']; $h5poptions->areamaxbytes = $this->_options['areamaxbytes'];
$h5poptions->env = 'editor'; $h5poptions->env = 'editor';
$h5poptions->itemid = $draftitemid; $h5poptions->itemid = $draftitemid;
$fpoptions['h5p'] = $h5poptions;
}
$fpoptions['image'] = $image_options; $fpoptions['image'] = $image_options;
$fpoptions['media'] = $media_options; $fpoptions['media'] = $media_options;
$fpoptions['link'] = $link_options; $fpoptions['link'] = $link_options;
$fpoptions['subtitle'] = $subtitle_options; $fpoptions['subtitle'] = $subtitle_options;
$fpoptions['h5p'] = $h5poptions;
} }
//If editor is required and tinymce, then set required_tinymce option to initalize tinymce validation. //If editor is required and tinymce, then set required_tinymce option to initalize tinymce validation.