Skip to content

Commit

Permalink
Added suffix for completion rules for Moodle 4.3+ (#533)
Browse files Browse the repository at this point in the history
Co-authored-by: Matthias Opitz <[email protected]>
  • Loading branch information
opitz and Matthias Opitz authored Feb 23, 2024
1 parent e4ce349 commit b361e85
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,19 @@ public function validation($data, $files) {
* @return string[]
*/
public function add_completion_rules() {
global $CFG;

// Changes for Moodle 4.3 - MDL-78516.
if ($CFG->branch < 403) {
$suffix = '';
} else {
$suffix = $this->get_suffix();
}

$mform =& $this->_form;
$mform->addElement('checkbox', 'completionsubmit', '', get_string('completionsubmit', 'questionnaire'));
return array('completionsubmit');
$mform->addElement('checkbox', 'completionsubmit' . $suffix, '',
get_string('completionsubmit', 'questionnaire'));
return ['completionsubmit' . $suffix];
}

/**
Expand Down

0 comments on commit b361e85

Please sign in to comment.