Skip to content

Commit 23e9a28

Browse files
committed
Fix issue #153
1 parent d4b78ba commit 23e9a28

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

mod_form.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,9 @@ public function definition() {
103103
* @return bool
104104
*/
105105
public function completion_rule_enabled($data): bool {
106-
return (!empty($data['completion_create_entry' . $this->get_suffix()]));
106+
// Compatibility check: get_suffix only exists in Moodle 4.3+.
107+
$suffix = method_exists($this, 'get_suffix') ? $this->get_suffix() : '';
108+
return (!empty($data['completion_create_entry' . $suffix]));
107109
}
108110

109111
/**
@@ -114,7 +116,9 @@ public function completion_rule_enabled($data): bool {
114116
public function add_completion_rules(): array {
115117
$mform = $this->_form;
116118

117-
$fieldname = 'completion_create_entry' . $this->get_suffix();
119+
// Compatibility check: get_suffix only exists in Moodle 4.3+.
120+
$suffix = method_exists($this, 'get_suffix') ? $this->get_suffix() : '';
121+
$fieldname = 'completion_create_entry' . $suffix;
118122

119123
$mform->addElement('advcheckbox', $fieldname, get_string('completiondetail:completion_create_entry', 'journal'));
120124

0 commit comments

Comments
 (0)