MDL-60736 tool_mobile: Return language settings in get_public_config WS
This commit is contained in:
@@ -151,6 +151,11 @@ class api {
|
||||
'tool_mobile_disabledfeatures' => get_config('tool_mobile', 'disabledfeatures'),
|
||||
'country' => clean_param($CFG->country, PARAM_NOTAGS),
|
||||
'agedigitalconsentverification' => \core_auth\digital_consent::is_age_digital_consent_verification_enabled(),
|
||||
'autolang' => $CFG->autolang,
|
||||
'lang' => clean_param($CFG->lang, PARAM_LANG), // Avoid breaking WS because of incorrect package langs.
|
||||
'langmenu' => $CFG->langmenu,
|
||||
'langlist' => $CFG->langlist,
|
||||
'locale' => $CFG->locale,
|
||||
);
|
||||
|
||||
$typeoflogin = get_config('tool_mobile', 'typeoflogin');
|
||||
|
||||
@@ -168,6 +168,11 @@ class external extends external_api {
|
||||
(only if age verification is enabled).', VALUE_OPTIONAL),
|
||||
'supportemail' => new external_value(PARAM_EMAIL, 'Site support contact email
|
||||
(only if age verification is enabled).', VALUE_OPTIONAL),
|
||||
'autolang' => new external_value(PARAM_INT, 'Whether to detect default language from browser setting.'),
|
||||
'lang' => new external_value(PARAM_LANG, 'Default language for the site.'),
|
||||
'langmenu' => new external_value(PARAM_INT, 'Whether the language menu should be displayed.'),
|
||||
'langlist' => new external_value(PARAM_RAW, 'Languages on language menu.'),
|
||||
'locale' => new external_value(PARAM_RAW, 'Sitewide locale.'),
|
||||
'warnings' => new external_warnings(),
|
||||
)
|
||||
);
|
||||
|
||||
@@ -88,6 +88,11 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
|
||||
'launchurl' => "$CFG->wwwroot/$CFG->admin/tool/mobile/launch.php",
|
||||
'country' => $CFG->country,
|
||||
'agedigitalconsentverification' => \core_auth\digital_consent::is_age_digital_consent_verification_enabled(),
|
||||
'autolang' => $CFG->autolang,
|
||||
'lang' => $CFG->lang,
|
||||
'langmenu' => $CFG->langmenu,
|
||||
'langlist' => $CFG->langlist,
|
||||
'locale' => $CFG->locale,
|
||||
'warnings' => array()
|
||||
);
|
||||
$this->assertEquals($expected, $result);
|
||||
@@ -101,6 +106,8 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
|
||||
set_config('logocompact', 'mock.png', 'core_admin');
|
||||
set_config('forgottenpasswordurl', 'mailto:[email protected]'); // Test old hack.
|
||||
set_config('agedigitalconsentverification', 1);
|
||||
set_config('autolang', 1);
|
||||
set_config('lang', 'a_b'); // Set invalid lang.
|
||||
|
||||
list($authinstructions, $notusedformat) = external_format_text($authinstructions, FORMAT_MOODLE, $context->id);
|
||||
$expected['registerauth'] = 'email';
|
||||
@@ -110,6 +117,8 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase {
|
||||
$expected['agedigitalconsentverification'] = true;
|
||||
$expected['supportname'] = $CFG->supportname;
|
||||
$expected['supportemail'] = $CFG->supportemail;
|
||||
$expected['autolang'] = '1';
|
||||
$expected['lang'] = ''; // Expect empty because it was set to an invalid lang.
|
||||
|
||||
if ($logourl = $OUTPUT->get_logo_url()) {
|
||||
$expected['logourl'] = $logourl->out(false);
|
||||
|
||||
Reference in New Issue
Block a user