[3.3] How do I set the default choice numbering to ABC rather than abc?

[3.3] How do I set the default choice numbering to ABC rather than abc?

by Sam Mudle -
Number of replies: 2

Ok, I used to know how to do this in 2.2, but in 3.3 it looks like the choice numbering for questions is somewhere else.

So I want every new question to have the choices in capital letters.

Who was the first president of the United States?

a. George Washington

b. Luke Skywalker

c. Babebraham Lincoln

d. Darth Vader

to

Who was the first president of the United States?

A. George Washington

B. Luke Skywalker

C. Babebraham Lincoln

D. Darth Vader

Since I write dozens a questions, having to set the dropdown on each one is annoying. How can I change the default?

I'm looking at this line of code:

https://github.com/moodle/moodle/blob/master/question/type/multichoice/edit_multichoice_form.php#L59

        $mform->addElement('select', 'answernumbering',
                get_string('answernumbering', 'qtype_multichoice'),
                qtype_multichoice::get_numbering_styles());
        $mform->setDefault('answernumbering', get_config('qtype_multichoice', 'answernumbering'));

But I don't know where it gets the default from?  How does get_config work?

Advice?

Average of ratings: -
In reply to Sam Mudle

Re: [3.3] How do I set the default choice numbering to ABC rather than abc?

by AL Rachels -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers

In my Moodle 3.3.1+ the fourth line you show (59) looks different. You seem to actually be looking at the code for Moodle 3.4. Looks to me like they are going to make that a configuration setting in Moodle 3.4. My 3.3.1+ line 59looks like this:

$mform->setDefault('answernumbering', 'abc');

When I change it to this I get the numbering you want:

$mform->setDefault('answernumbering', 'ABCD');

The down side to doing this, is that your change will get wiped out every time you do an upgrade, but as I mentioned, I think from looking at the code in the link you give, it looks like they are going to make this into a setting so you will not need to modify code in the future.



Average of ratings: Useful (1)
In reply to AL Rachels

Re: [3.3] How do I set the default choice numbering to ABC rather than abc?

by Sam Mudle -

You are correct sir.

I was looking at the Trunk on github.  On the 3.3 branch, it's there.  Super easy hack.

BTW, there are several requests for the question type defaults to be set, so maybe in 3.4 on, you won't need code hacks.