MDL-70355 calendar: Filter popuptext for calendar entries.
authorLuca Bösch <luca.boesch@bfh.ch>
Thu, 3 Dec 2020 10:40:50 +0000 (11:40 +0100)
committerLuca Bösch <luca.boesch@bfh.ch>
Thu, 17 Dec 2020 16:44:04 +0000 (17:44 +0100)
calendar/classes/external/calendar_event_exporter.php

index e943e9c..bfa2368 100644 (file)
@@ -116,7 +116,11 @@ class calendar_event_exporter extends event_exporter_base {
         $values['islastday'] = false;
         $today = $this->related['type']->timestamp_to_date_array($this->related['today']);
 
-        $values['popupname'] = $this->event->get_name();
+        if ($hascourse) {
+            $values['popupname'] = external_format_string($this->event->get_name(), \context_course::instance($course->id), true);
+        } else {
+            $values['popupname'] = external_format_string($this->event->get_name(), \context_system::instance(), true);
+        }
 
         $times = $this->event->get_times();
         if ($duration = $times->get_duration()) {