diff --git a/question/behaviour/informationitem/renderer.php b/question/behaviour/informationitem/renderer.php index 29c5f8c0829..99a78529868 100644 --- a/question/behaviour/informationitem/renderer.php +++ b/question/behaviour/informationitem/renderer.php @@ -36,7 +36,7 @@ defined('MOODLE_INTERNAL') || die(); */ class qbehaviour_informationitem_renderer extends qbehaviour_renderer { public function controls(question_attempt $qa, question_display_options $options) { - if ($qa->get_state() != question_state::$todo) { + if ($options->readonly || $qa->get_state() != question_state::$todo) { return ''; } diff --git a/question/behaviour/informationitem/tests/walkthrough_test.php b/question/behaviour/informationitem/tests/walkthrough_test.php index 3cdb4947bcd..237412f3b68 100644 --- a/question/behaviour/informationitem/tests/walkthrough_test.php +++ b/question/behaviour/informationitem/tests/walkthrough_test.php @@ -49,10 +49,17 @@ class qbehaviour_informationitem_walkthrough_test extends qbehaviour_walkthrough $this->check_current_state(question_state::$todo); $this->check_current_mark(null); $this->check_current_output($this->get_contains_question_text_expectation($description), - new question_contains_tag_with_attributes('input', array('type' => 'hidden', - 'name' => $this->quba->get_field_prefix($this->slot) . '-seen', 'value' => 1)), + $this->get_contains_hidden_expectation( + $this->quba->get_field_prefix($this->slot) . '-seen', 1), $this->get_does_not_contain_feedback_expectation()); + // Check no hidden input when read-only. + $this->displayoptions->readonly = true; + $this->check_current_output($this->get_contains_question_text_expectation($description), + $this->get_does_not_contain_hidden_expectation( + $this->quba->get_field_prefix($this->slot) . '-seen', 1)); + $this->displayoptions->readonly = false; + // Process a submission indicating this question has been seen. $this->process_submission(array('-seen' => 1));