MDL-86575 cohort: format cohort names in external service return data.
This commit is contained in:
committed by
Huong Nguyen
parent
8f7c9ae1b5
commit
431040b341
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user