diff --git a/admin/tool/mobile/classes/api.php b/admin/tool/mobile/classes/api.php index 657a0e28f1b..e25a57b0d7e 100644 --- a/admin/tool/mobile/classes/api.php +++ b/admin/tool/mobile/classes/api.php @@ -100,7 +100,7 @@ class api { * @return array with the settings and warnings */ public static function get_public_config() { - global $CFG, $SITE, $PAGE; + global $CFG, $SITE, $PAGE, $OUTPUT; $context = context_system::instance(); // We need this to make work the format text functions. @@ -135,6 +135,14 @@ class api { $url = new moodle_url("/$CFG->admin/tool/mobile/launch.php"); $settings['launchurl'] = $url->out(false); } + + if ($logourl = $OUTPUT->get_logo_url()) { + $settings['logourl'] = $logourl->out(false); + } + if ($compactlogourl = $OUTPUT->get_compact_logo_url()) { + $settings['compactlogourl'] = $compactlogourl->out(false); + } + return $settings; } diff --git a/admin/tool/mobile/classes/external.php b/admin/tool/mobile/classes/external.php index e06fe73deed..3094ebd090f 100644 --- a/admin/tool/mobile/classes/external.php +++ b/admin/tool/mobile/classes/external.php @@ -144,6 +144,8 @@ class external extends external_api { 'enablemobilewebservice' => new external_value(PARAM_INT, 'Whether the Mobile service is enabled.'), 'maintenanceenabled' => new external_value(PARAM_INT, 'Whether site maintenance is enabled.'), 'maintenancemessage' => new external_value(PARAM_RAW, 'Maintenance message.'), + 'logourl' => new external_value(PARAM_URL, 'The site logo URL', VALUE_OPTIONAL), + 'compactlogourl' => new external_value(PARAM_URL, 'The site compact logo URL', VALUE_OPTIONAL), 'typeoflogin' => new external_value(PARAM_INT, 'The type of login. 1 for app, 2 for browser, 3 for embedded.'), 'launchurl' => new external_value(PARAM_URL, 'SSO login launch URL. Empty if it won\'t be used.', VALUE_OPTIONAL), 'warnings' => new external_warnings(), diff --git a/admin/tool/mobile/tests/externallib_test.php b/admin/tool/mobile/tests/externallib_test.php index 7300cc7fe73..eacb24eeeb9 100644 --- a/admin/tool/mobile/tests/externallib_test.php +++ b/admin/tool/mobile/tests/externallib_test.php @@ -56,7 +56,7 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase { } public function test_get_public_config() { - global $CFG, $SITE; + global $CFG, $SITE, $OUTPUT; $this->resetAfterTest(true); $result = external::get_public_config(); @@ -89,11 +89,20 @@ class tool_mobile_external_testcase extends externallib_advanced_testcase { $authinstructions = 'Something with html tags'; set_config('auth_instructions', $authinstructions); set_config('typeoflogin', api::LOGIN_VIA_BROWSER, 'tool_mobile'); + set_config('logo', 'mock.png', 'core_admin'); + set_config('logocompact', 'mock.png', 'core_admin'); $expected['registerauth'] = 'email'; $expected['authinstructions'] = format_text($authinstructions); $expected['typeoflogin'] = api::LOGIN_VIA_BROWSER; - $expected['launchurl'] = "$CFG->wwwroot/$CFG->admin/tool/mobile/launch.php";; + $expected['launchurl'] = "$CFG->wwwroot/$CFG->admin/tool/mobile/launch.php"; + + if ($logourl = $OUTPUT->get_logo_url()) { + $expected['logourl'] = $logourl->out(false); + } + if ($compactlogourl = $OUTPUT->get_compact_logo_url()) { + $expected['compactlogourl'] = $compactlogourl->out(false); + } $result = external::get_public_config(); $result = external_api::clean_returnvalue(external::get_public_config_returns(), $result);