From 880532c71a69b226d9d135dcd5bd35bdb52b7b55 Mon Sep 17 00:00:00 2001 From: Jun Pataleta Date: Fri, 17 Feb 2023 15:32:02 +0800 Subject: [PATCH] MDL-76849 qtype_numerical: Include question number in answer fields * Also covers its qtype_calculated and qtype_calculatedsimple which extend its renderer class --- question/type/numerical/renderer.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/question/type/numerical/renderer.php b/question/type/numerical/renderer.php index 31c08384653..98f48921c00 100644 --- a/question/type/numerical/renderer.php +++ b/question/type/numerical/renderer.php @@ -114,8 +114,8 @@ class qtype_numerical_renderer extends qtype_renderer { } 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)); @@ -125,7 +125,9 @@ class qtype_numerical_renderer extends qtype_renderer { if (!$placeholder) { $result .= html_writer::start_tag('div', array('class' => 'ablock form-inline')); - $result .= html_writer::tag('label', get_string('answercolon', 'qtype_numerical'), array('for' => $inputattributes['id'])); + $label = $options->add_question_identifier_to_label(get_string('answercolon', 'qtype_numerical'), true); + $result .= html_writer::tag('label', $label, + array('for' => $inputattributes['id'])); $result .= html_writer::tag('span', $input, array('class' => 'answer')); $result .= html_writer::end_tag('div'); }