Skip to content

Commit

Permalink
Merge pull request #141 from opitz/MOODLE_403_STABLE
Browse files Browse the repository at this point in the history
Added required suffix for custom completion rule in 4.3+
  • Loading branch information
danmarsden authored Feb 29, 2024
2 parents 7d9d0fa + b8c0f15 commit 278bb9e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions mod_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -295,15 +295,19 @@ public function data_postprocessing($data) {
public function add_completion_rules(): array {
$mform = $this->_form;

// Using a suffix is mandatory for Moodle 4.3+.
$suffix = $this->get_suffix();

$options = [
0 => get_string('completiondetail:attendance_disabled', 'facetoface'),
MDL_F2F_STATUS_PARTIALLY_ATTENDED => get_string('completiondetail:attendance_partial', 'facetoface'),
MDL_F2F_STATUS_FULLY_ATTENDED => get_string('completiondetail:attendance_full', 'facetoface'),
];
$mform->addElement('select', 'completionattendance', get_string('completiondetail:attendance', 'facetoface'), $options);
$mform->setDefault('completionattendance', MDL_F2F_STATUS_FULLY_ATTENDED);
$mform->addElement('select', 'completionattendance' . $suffix,
get_string('completiondetail:attendance', 'facetoface'), $options);
$mform->setDefault('completionattendance' . $suffix, MDL_F2F_STATUS_FULLY_ATTENDED);

return ['completionattendance'];
return ['completionattendance' . $suffix];
}

/**
Expand Down

0 comments on commit 278bb9e

Please sign in to comment.