mirror of
https://github.com/moodle/moodle.git
synced 2025-01-17 13:38:32 +01:00
MDL-56020 search: Return global search settings
This commit is contained in:
parent
f94e1ef3c9
commit
325ef8095e
@ -373,6 +373,16 @@ class api {
|
||||
$settings->forcetimezone = $CFG->forcetimezone;
|
||||
}
|
||||
|
||||
if (empty($section) || $section === 'manageglobalsearch') {
|
||||
$settings->searchengine = $CFG->searchengine;
|
||||
$settings->searchenablecategories = $CFG->searchenablecategories;
|
||||
$settings->searchdefaultcategory = $CFG->searchdefaultcategory;
|
||||
$settings->searchhideallcategory = $CFG->searchhideallcategory;
|
||||
$settings->searchmaxtopresults = $CFG->searchmaxtopresults;
|
||||
$settings->searchbannerenable = $CFG->searchbannerenable;
|
||||
$settings->searchbanner = $CFG->searchbanner;
|
||||
}
|
||||
|
||||
return $settings;
|
||||
}
|
||||
|
||||
@ -535,6 +545,7 @@ class api {
|
||||
'CoreFilterDelegate' => new lang_string('type_filter_plural', 'plugin'),
|
||||
'CoreReportBuilderDelegate' => new lang_string('reportbuilder', 'core_reportbuilder'),
|
||||
'NoDelegate_CoreUserSupport' => new lang_string('contactsitesupport', 'admin'),
|
||||
'NoDelegate_GlobalSearch' => new lang_string('globalsearch', 'search'),
|
||||
),
|
||||
"$mainmenu" => array(
|
||||
'$mmSideMenuDelegate_mmaFrontpage' => new lang_string('sitehome'),
|
||||
|
@ -259,6 +259,14 @@ class externallib_test extends externallib_advanced_testcase {
|
||||
$expected[] = ['name' => 'timezone', 'value' => $CFG->timezone];
|
||||
$expected[] = ['name' => 'forcetimezone', 'value' => $CFG->forcetimezone];
|
||||
|
||||
$expected[] = ['name' => 'searchengine', 'value' => $CFG->searchengine];
|
||||
$expected[] = ['name' => 'searchenablecategories', 'value' => $CFG->searchenablecategories];
|
||||
$expected[] = ['name' => 'searchdefaultcategory', 'value' => $CFG->searchdefaultcategory];
|
||||
$expected[] = ['name' => 'searchhideallcategory', 'value' => $CFG->searchhideallcategory];
|
||||
$expected[] = ['name' => 'searchmaxtopresults', 'value' => $CFG->searchmaxtopresults];
|
||||
$expected[] = ['name' => 'searchbannerenable', 'value' => $CFG->searchbannerenable];
|
||||
$expected[] = ['name' => 'searchbanner', 'value' => $CFG->searchbanner];
|
||||
|
||||
$this->assertCount(0, $result['warnings']);
|
||||
$this->assertEquals($expected, $result['settings']);
|
||||
|
||||
|
@ -156,8 +156,9 @@ class core_webservice_external extends \core_external\external_api {
|
||||
$siteinfo['mobilecssurl'] = !empty($CFG->mobilecssurl) ? $CFG->mobilecssurl : '';
|
||||
|
||||
// Retrieve some advanced features. Only enable/disable ones (bool).
|
||||
$advancedfeatures = array("usecomments", "usetags", "enablenotes", "messaging", "enableblogs",
|
||||
"enablecompletion", "enablebadges", "messagingallusers", "enablecustomreports");
|
||||
$advancedfeatures = ["usecomments", "usetags", "enablenotes", "messaging", "enableblogs",
|
||||
"enablecompletion", "enablebadges", "messagingallusers", "enablecustomreports", "enableglobalsearch"];
|
||||
|
||||
foreach ($advancedfeatures as $feature) {
|
||||
if (isset($CFG->{$feature})) {
|
||||
$siteinfo['advancedfeatures'][] = array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user