mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-62815 mod_lti: fix error when clicking 'Select content' option
This commit is contained in:
parent
dcb0f01f58
commit
b791ed15e2
@ -538,11 +538,20 @@
|
||||
* @returns {number|boolean} The ID of the tool type if it supports Content-Item selection. False, otherwise.
|
||||
*/
|
||||
getContentItemId: function() {
|
||||
var selected = this.getSelectedToolTypeOption();
|
||||
if (selected.getAttribute('data-contentitem')) {
|
||||
return selected.getAttribute('data-id');
|
||||
try {
|
||||
var selected = this.getSelectedToolTypeOption();
|
||||
if (selected.getAttribute('data-contentitem')) {
|
||||
return selected.getAttribute('data-id');
|
||||
}
|
||||
return false;
|
||||
} catch (err) {
|
||||
// Tool selector not available - check for hidden fields instead.
|
||||
var content = Y.one('input[name="contentitem"]');
|
||||
if (!content || !content.get('value')) {
|
||||
return false;
|
||||
}
|
||||
return Y.one('input[name="typeid"]').get('value');
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -162,6 +162,13 @@ class mod_lti_mod_form extends moodleform_mod {
|
||||
} else {
|
||||
$mform->addElement('hidden', 'typeid', $typeid);
|
||||
$mform->setType('typeid', PARAM_INT);
|
||||
if ($typeid) {
|
||||
$config = lti_get_type_config($typeid);
|
||||
if (!empty($config['contentitem'])) {
|
||||
$mform->addElement('hidden', 'contentitem', 1);
|
||||
$mform->setType('contentitem', PARAM_INT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Add button that launches the content-item selection dialogue.
|
||||
|
Loading…
x
Reference in New Issue
Block a user