mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
MDL-77766 qtype_multichoice: Respect showstandardinstruction
* When showstandardinstruction is set to no, replace the standard instruction with the generic "Answer" text for the answer options fieldset's legend.
This commit is contained in:
parent
4e632b7251
commit
75984fb226
2 changed files with 5 additions and 3 deletions
|
@ -149,11 +149,13 @@ abstract class qtype_multichoice_renderer_base extends qtype_with_combined_feedb
|
||||||
$result .= html_writer::tag('div', $question->format_questiontext($qa),
|
$result .= html_writer::tag('div', $question->format_questiontext($qa),
|
||||||
array('class' => 'qtext'));
|
array('class' => 'qtext'));
|
||||||
|
|
||||||
$questionnumber = $options->add_question_identifier_to_label($this->prompt(), true, true);
|
|
||||||
$result .= html_writer::start_tag('fieldset', array('class' => 'ablock no-overflow visual-scroll-x'));
|
$result .= html_writer::start_tag('fieldset', array('class' => 'ablock no-overflow visual-scroll-x'));
|
||||||
$legendclass = 'sr-only';
|
|
||||||
if ($question->showstandardinstruction == 1) {
|
if ($question->showstandardinstruction == 1) {
|
||||||
$legendclass = '';
|
$legendclass = '';
|
||||||
|
$questionnumber = $options->add_question_identifier_to_label($this->prompt(), true, true);
|
||||||
|
} else {
|
||||||
|
$questionnumber = $options->add_question_identifier_to_label(get_string('answer'), true, true);
|
||||||
|
$legendclass = 'sr-only';
|
||||||
}
|
}
|
||||||
$legendattrs = [
|
$legendattrs = [
|
||||||
'class' => 'prompt h6 font-weight-normal ' . $legendclass,
|
'class' => 'prompt h6 font-weight-normal ' . $legendclass,
|
||||||
|
|
|
@ -302,7 +302,7 @@ class walkthrough_test extends \qbehaviour_walkthrough_test_base {
|
||||||
$this->render();
|
$this->render();
|
||||||
|
|
||||||
// Check for 'Show standard instruction'.
|
// Check for 'Show standard instruction'.
|
||||||
$standardinstruction = \html_writer::tag('legend', get_string('selectmulti', 'qtype_multichoice'), [
|
$standardinstruction = \html_writer::tag('legend', get_string('answer'), [
|
||||||
'class' => 'prompt h6 font-weight-normal sr-only'
|
'class' => 'prompt h6 font-weight-normal sr-only'
|
||||||
]);
|
]);
|
||||||
$this->assertStringContainsString($standardinstruction, $this->currentoutput);
|
$this->assertStringContainsString($standardinstruction, $this->currentoutput);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue