From c68f118e3546cf7c3cfe8d3df8e5e31de9abcd36 Mon Sep 17 00:00:00 2001 From: Nicolas Roeser Date: Wed, 12 Jun 2019 10:11:28 +0200 Subject: [PATCH] MDL-65893 webservice: format site name (handle language tags etc.) Allow web service clients (like the Moodle App) to benefit from a formatted (filtered) site name. Select the filtered (localized etc.) string on server side, before it is sent to the web service client. For example, this translates a site name which uses language tags in curly braces when using the filter_multilang2 plugin. Thanks-To: Juan Leyva Thanks-To: Kathrin Osswald --- webservice/externallib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webservice/externallib.php b/webservice/externallib.php index 94e3858c0a0..3614bfe1352 100644 --- a/webservice/externallib.php +++ b/webservice/externallib.php @@ -77,6 +77,7 @@ class core_webservice_external extends external_api { array('serviceshortnames'=>$serviceshortnames)); $context = context_user::instance($USER->id); + $systemcontext = context_system::instance(); $userpicture = new user_picture($USER); $userpicture->size = 1; // Size f1. @@ -84,7 +85,7 @@ class core_webservice_external extends external_api { // Site information. $siteinfo = array( - 'sitename' => $SITE->fullname, + 'sitename' => external_format_string($SITE->fullname, $systemcontext), 'siteurl' => $CFG->wwwroot, 'username' => $USER->username, 'firstname' => $USER->firstname,