Skip to content

Commit

Permalink
MDL-76849 qtype_shortanswer: Include question number in answer fields
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Mar 9, 2023
1 parent 91205c8 commit 4e4e66c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions question/type/shortanswer/renderer.php
Expand Up @@ -75,8 +75,8 @@ public function formulation_and_controls(question_attempt $qa,
$input = html_writer::empty_tag('input', $inputattributes) . $feedbackimg;

if ($placeholder) {
$inputinplace = html_writer::tag('label', get_string('answer'),
array('for' => $inputattributes['id'], 'class' => 'accesshide'));
$inputinplace = html_writer::tag('label', $options->add_question_identifier_to_label(get_string('answer')),
array('for' => $inputattributes['id'], 'class' => 'sr-only'));
$inputinplace .= $input;
$questiontext = substr_replace($questiontext, $inputinplace,
strpos($questiontext, $placeholder), strlen($placeholder));
Expand All @@ -86,8 +86,9 @@ public function formulation_and_controls(question_attempt $qa,

if (!$placeholder) {
$result .= html_writer::start_tag('div', array('class' => 'ablock form-inline'));
$result .= html_writer::tag('label', get_string('answer', 'qtype_shortanswer',
html_writer::tag('span', $input, array('class' => 'answer'))),
$answerspan = html_writer::tag('span', $input, array('class' => 'answer'));
$label = $options->add_question_identifier_to_label(get_string('answercolon', 'qtype_numerical'), true);
$result .= html_writer::tag('label', $label . $answerspan,
array('for' => $inputattributes['id']));
$result .= html_writer::end_tag('div');
}
Expand Down

0 comments on commit 4e4e66c

Please sign in to comment.