From 1382607708831c867d4ad5c318500141454968ba Mon Sep 17 00:00:00 2001 From: Huong Nguyen Date: Thu, 21 Oct 2021 14:51:32 +0700 Subject: [PATCH] MDL-71953 calendar: Fix behat failures --- .../classes/external/event_exporter_base.php | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/calendar/classes/external/event_exporter_base.php b/calendar/classes/external/event_exporter_base.php index e284b24b962..2ae3cc579bd 100644 --- a/calendar/classes/external/event_exporter_base.php +++ b/calendar/classes/external/event_exporter_base.php @@ -101,6 +101,19 @@ class event_exporter_base extends exporter { if ($cm = $event->get_course_module()) { $data->modulename = $cm->get('modname'); $data->instance = $cm->get('id'); + $data->activityname = $cm->get('name'); + + $component = 'mod_' . $data->modulename; + if (!component_callback_exists($component, 'core_calendar_get_event_action_string')) { + $modulename = get_string('modulename', $data->modulename); + $data->activitystr = get_string('requiresaction', 'calendar', $modulename); + } else { + $data->activitystr = component_callback( + $component, + 'core_calendar_get_event_action_string', + [$event->get_type()] + ); + } } parent::__construct($data, $related); @@ -175,6 +188,18 @@ class event_exporter_base extends exporter { 'default' => null, 'null' => NULL_ALLOWED ], + 'activityname' => [ + 'type' => PARAM_TEXT, + 'optional' => true, + 'default' => null, + 'null' => NULL_ALLOWED + ], + 'activitystr' => [ + 'type' => PARAM_TEXT, + 'optional' => true, + 'default' => null, + 'null' => NULL_ALLOWED + ], 'instance' => [ 'type' => PARAM_INT, 'optional' => true,