mirror of
https://github.com/moodle/moodle.git
synced 2025-02-25 20:43:33 +01:00
MDL-63015 mod_feedback: preview feedback questions in read-only.
This commit is contained in:
parent
1a33da6637
commit
088cb7ad8f
@ -242,6 +242,15 @@ class mod_feedback_complete_form extends moodleform {
|
||||
return $this->mode == self::MODE_VIEW_RESPONSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the form is considered read-only (e.g. when previewing it)
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function is_readonly(): bool {
|
||||
return $this->mode === self::MODE_PRINT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current course module
|
||||
* @return cm_info
|
||||
@ -327,6 +336,11 @@ class mod_feedback_complete_form extends moodleform {
|
||||
$element->freeze();
|
||||
}
|
||||
|
||||
// For read-only forms, just disable each added element.
|
||||
if ($this->is_readonly()) {
|
||||
$this->_form->disabledIf($element->getName(), 'id');
|
||||
}
|
||||
|
||||
// Add red asterisks on required fields.
|
||||
if ($item->required) {
|
||||
$required = $OUTPUT->pix_icon('req', get_string('requiredelement', 'form'), 'moodle', ['class' => 'ml-2']);
|
||||
|
Loading…
x
Reference in New Issue
Block a user