Want to change GUI for short answer.

Want to change GUI for short answer.

- Melissa . の投稿
返信数: 2

I want to change the gui for entering in a short answer, so the teacher and the student can both use the Atto editor that is used for the question.  The reason I want to do that is that the answer is going to be in a rtl language, so I need the extra functionality of the Atto editor provides.  Having multilines is not an issue.  

Example: The question is an English sentence, "Who are you?" and the answer is a Hebrew translation:

"מי את?"  

As you can see here, without the rtl buttons even in the Atto editor the text displays incorrectly.  I have already changed my Atto defaults to show the rtl buttons.

I am using Moodle 3.2.  I can see the file: shortanswer/edit_shortanswer_form.php

And then I see these two lines of code:

        $this->add_per_answer_fields($mform, get_string('answerno', 'qtype_shortanswer', '{no}'), question_bank::fraction_options());

        $this->add_interactive_settings();

But I can't find these two functions to change the answer edit box from being just one line to an Atto editor.

Any help would be appreciated.  

Melissa


Melissa . への返信

Re: Want to change GUI for short answer.

- Marcus Green の投稿
画像 Core developers 画像 Particularly helpful Moodlers 画像 Plugin developers 画像 Testers

The bit the student sees at runtime is generated from renderer.php

Marcus Green への返信

Re: Want to change GUI for short answer.

- Melissa . の投稿

Found my solution ...

/question/type/edit_question_form.php 

(This is located in the directory above each specific question type)

There is a function called "get_per_answer_fields()".

$answeroptions[] = $mform->createElement('text',

I changed the line to 

$answeroptions[] = $mform->createElement('editor',

Since I did the change outside of any specific questions, all questions that had this problem (multiple choice, matching, short answer, etc) are now fixed.

It definitely pays to get a good night's sleep to clear your mind.  笑顔