diff --git a/calendar/lib.php b/calendar/lib.php index f62d431258a..c00c505d555 100644 --- a/calendar/lib.php +++ b/calendar/lib.php @@ -3034,7 +3034,7 @@ function calendar_output_fragment_event_form($args) { $groupcoursedata = groups_get_course_data($courseid); $formoptions['groups'] = []; foreach ($groupcoursedata->groups as $groupid => $groupdata) { - $formoptions['groups'][$groupid] = $groupdata->name; + $formoptions['groups'][$groupid] = format_string($groupdata->name, true, ['context' => $context]); } } @@ -3078,7 +3078,7 @@ function calendar_output_fragment_event_form($args) { $groupcoursedata = groups_get_course_data($event->courseid); $formoptions['groups'] = []; foreach ($groupcoursedata->groups as $groupid => $groupdata) { - $formoptions['groups'][$groupid] = $groupdata->name; + $formoptions['groups'][$groupid] = format_string($groupdata->name, true, ['context' => $context]); } } diff --git a/calendar/tests/behat/calendar.feature b/calendar/tests/behat/calendar.feature index 14f9951eb89..80667d7d865 100644 --- a/calendar/tests/behat/calendar.feature +++ b/calendar/tests/behat/calendar.feature @@ -454,3 +454,37 @@ Feature: Perform basic calendar functionality And I press "Save" And I click on "type change test event" "link" And I should see "Category event" + + @javascript + Scenario: Group multilang tags are respected on event forms + Given the "multilang" filter is "on" + And the "multilang" filter applies to "content and headings" + And the following "courses" exist: + | fullname | shortname | format | category | + | Course 5 | C5 | topics | cata | + And the following "groups" exist: + | name | course | idnumber | + | GroupGrupo 2 | C5 | G2 | + And the following "blocks" exist: + | blockname | contextlevel | reference | pagetypepattern | defaultregion | + | calendar_month | Course | C5 | course-view-* | side-pre | + And I am on the "Course 5" course page logged in as admin + And I follow "Course calendar" + # New event form. + And I press "New event" + When I set the following fields to these values: + | Event title | Group 2 event | + | Type of event | Group | + Then I should see "Group 2" + And I should not see "GroupGrupo 2" + And I press "Save" + And I am on "Course 5" course homepage + And I follow "Course calendar" + # Preview event modal. + And I click on "Group 2 event" "link" + And I should see "Group 2" + And I should not see "GroupGrupo 2" + # Edit event form. + And I press "Edit" + And I should see "Group 2" + And I should not see "GroupGrupo 2"