Skip to content

Commit a297885

Browse files
authored
Merge pull request #224 from lucaboesch/purpose
Support Moodle ≥ 4.0 activity chooser purpose color.
2 parents c00260d + 49fe8c0 commit a297885

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

lib.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,20 @@ function capquiz_reset_gradebook($courseid, $type = '') {
238238
}
239239
}
240240

241+
242+
// Ugly hack to make 3.11 and 4.0 work seamlessly.
243+
if (!defined('FEATURE_MOD_PURPOSE')) {
244+
define('FEATURE_MOD_PURPOSE', 'mod_purpose');
245+
}
246+
if (!defined('MOD_PURPOSE_ASSESSMENT')) {
247+
define('MOD_PURPOSE_ASSESSMENT', 'assessment');
248+
}
249+
241250
/**
242251
* Checks if $feature is supported
243252
*
244253
* @param string $feature
245-
* @return bool
254+
* @return mixed
246255
*/
247256
function capquiz_supports($feature) {
248257
switch ($feature) {
@@ -252,7 +261,10 @@ function capquiz_supports($feature) {
252261
case FEATURE_USES_QUESTIONS:
253262
case FEATURE_GRADE_HAS_GRADE:
254263
return true;
264+
case FEATURE_MOD_PURPOSE:
265+
return MOD_PURPOSE_ASSESSMENT;
255266
default:
256267
return false;
257268
}
258269
}
270+

0 commit comments

Comments
 (0)