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