From 9c48b32c81b537139bfc4ef75eff176b70c4e401 Mon Sep 17 00:00:00 2001
From: Anisa <kusumadewi@itc.rwth-aachen.de>
Date: Tue, 4 Apr 2023 13:16:45 +0200
Subject: [PATCH] make feature_of_purpose just for V4

---
 lib.php     | 8 ++++++--
 version.php | 2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lib.php b/lib.php
index 322fd59..dd4228b 100644
--- a/lib.php
+++ b/lib.php
@@ -29,6 +29,12 @@ require_once($CFG->dirroot . '/mod/pdfannotator/locallib.php');
  * @return mixed True if module supports feature, false if not, null if doesn't know
  */
 function pdfannotator_supports($feature) {
+    if (defined('FEATURE_MOD_PURPOSE')) {
+        // Only defined in M4.0+.
+        if ($feature === FEATURE_MOD_PURPOSE) {
+            return MOD_PURPOSE_COMMUNICATION;
+        }
+    }
     switch($feature) {
         case FEATURE_GROUPS:
             return true;
@@ -54,8 +60,6 @@ function pdfannotator_supports($feature) {
             return true;
         case FEATURE_COMMENT:
             return true;
-        case FEATURE_MOD_PURPOSE:
-            return MOD_PURPOSE_COMMUNICATION;
         default:
             return null;
     }
diff --git a/version.php b/version.php
index ee31937..ee284cb 100644
--- a/version.php
+++ b/version.php
@@ -25,7 +25,7 @@
 defined('MOODLE_INTERNAL') || die();
 
 $plugin->component = 'mod_pdfannotator';
-$plugin->version   = 2023033000;
+$plugin->version   = 2023040400;
 $plugin->release  = 'PDF Annotator v1.5 release 3';
 $plugin->requires  = 2021051700;
 $plugin->maturity  = MATURITY_STABLE;
-- 
GitLab