diff --git a/public/cohort/externallib.php b/public/cohort/externallib.php index 83ea6249cb8..0a759b5f550 100644 --- a/public/cohort/externallib.php +++ b/public/cohort/externallib.php @@ -145,6 +145,8 @@ class core_cohort_external extends external_api { $cohort->id = cohort_add_cohort($cohort); + $cohort->name = \core_external\util::format_string($cohort->name, $context); + list($cohort->description, $cohort->descriptionformat) = \core_external\util::format_text($cohort->description, $cohort->descriptionformat, $context, 'cohort', 'description', $cohort->id); @@ -284,6 +286,8 @@ class core_cohort_external extends external_api { throw new required_capability_exception($context, 'moodle/cohort:view', 'nopermissions', ''); } + $cohort->name = \core_external\util::format_string($cohort->name, $context); + // Only return theme when $CFG->allowcohortthemes is enabled. if (!empty($cohort->theme) && empty($CFG->allowcohortthemes)) { $cohort->theme = null; @@ -427,6 +431,8 @@ class core_cohort_external extends external_api { foreach ($results as $key => $cohort) { $cohortcontext = context::instance_by_id($cohort->contextid); + $cohort->name = \core_external\util::format_string($cohort->name, $cohortcontext); + // Only return theme when $CFG->allowcohortthemes is enabled. if (!empty($cohort->theme) && empty($CFG->allowcohortthemes)) { $cohort->theme = null;