Skip to content

Commit

Permalink
Set the default response format via a new site wide setting
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusgreen committed Jun 20, 2024
1 parent 41f255a commit b6bdca5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion edit_aitext_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ protected function definition_inner($mform) {

$mform->addElement('select', 'responseformat',
get_string('responseformat', 'qtype_aitext'), $qtype->response_formats());
$mform->setDefault('responseformat', $this->get_default_value('responseformat', 'editor'));
xdebug_break();
$mform->setDefault('responseformat', get_config('qtype_aitext', 'responseformat'));

$mform->addElement('select', 'responsefieldlines',
get_string('responsefieldlines', 'qtype_aitext'), $qtype->response_sizes());
Expand Down
1 change: 1 addition & 0 deletions lang/en/qtype_aitext.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
$string['prompttester'] = 'Prompt Tester';
$string['responsefieldlines'] = 'Input box size';
$string['responseformat'] = 'Response format';
$string['responseformat_setting'] = 'The editor the student uses when responding';
$string['responseoptions'] = 'Response options';
$string['responsenotrequired'] = 'Text input is optional';
$string['responseisrequired'] = 'Require the student to enter text';
Expand Down
3 changes: 1 addition & 2 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

use Random\RandomException;

defined('MOODLE_INTERNAL') || die();
/**
* Generates the output for aitext questions.
*
* @copyright 2023 Marcus Green
* @copyright 2024 Marcus Green
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_aitext_renderer extends qtype_renderer {
Expand Down
7 changes: 7 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,12 @@
20,
6
));
$settings->add(new admin_setting_configselect(
'qtype_aitext/responseformat',
new lang_string('responseformat', 'qtype_aitext'),
new lang_string('responseformat_setting', 'qtype_aitext'),
0, ['plain' => 'plain', 'editor' => 'editor', 'monospaced' => 'monospaced']
));

}

0 comments on commit b6bdca5

Please sign in to comment.