diff --git a/admin/category.php b/admin/category.php
index 31df0629136..e11507a218a 100644
--- a/admin/category.php
+++ b/admin/category.php
@@ -48,6 +48,12 @@ if (!($settingspage->check_access())) {
print_error('accessdenied', 'admin');
}
+$hassiteconfig = has_capability('moodle/site:config', $PAGE->context);
+if ($hassiteconfig) {
+ $PAGE->add_header_action($OUTPUT->render_from_template('core_admin/header_search_input', [
+ 'action' => new moodle_url('/admin/search.php'),
+ ]));
+}
$statusmsg = '';
$errormsg = '';
diff --git a/admin/search.php b/admin/search.php
index c225d72cb69..2d1920d5ec1 100644
--- a/admin/search.php
+++ b/admin/search.php
@@ -28,18 +28,6 @@ if ($hassiteconfig && moodle_needs_upgrading()) {
admin_externalpage_setup('search', '', array('query' => $query)); // now hidden page
$PAGE->set_heading(get_string('administrationsite')); // Has to be after setup since it has its' own heading set_heading.
-if ($hassiteconfig) {
- $data = [
- 'action' => new moodle_url('/admin/search.php'),
- 'btnclass' => 'btn-primary',
- 'inputname' => 'query',
- 'searchstring' => get_string('search'),
- 'query' => $query,
- 'extraclasses' => 'd-flex justify-content-end'
- ];
- $PAGE->add_header_action($OUTPUT->render_from_template('core/search_input', $data));
-}
-
$adminroot = admin_get_root(); // need all settings here
$adminroot->search = $query; // So we can reference it in search boxes later in this invocation
$statusmsg = '';
diff --git a/admin/settings.php b/admin/settings.php
index 1df90252c54..7adbac3ac2f 100644
--- a/admin/settings.php
+++ b/admin/settings.php
@@ -33,6 +33,13 @@ if (!($settingspage->check_access())) {
die;
}
+$hassiteconfig = has_capability('moodle/site:config', $PAGE->context);
+if ($hassiteconfig) {
+ $PAGE->add_header_action($OUTPUT->render_from_template('core_admin/header_search_input', [
+ 'action' => new moodle_url('/admin/search.php'),
+ ]));
+}
+
/// WRITING SUBMITTED DATA (IF ANY) -------------------------------------------------------------------------------
$statusmsg = '';
diff --git a/admin/templates/header_search_input.mustache b/admin/templates/header_search_input.mustache
new file mode 100644
index 00000000000..51a6386f105
--- /dev/null
+++ b/admin/templates/header_search_input.mustache
@@ -0,0 +1,52 @@
+{{!
+ This file is part of Moodle - http://moodle.org/
+
+ Moodle is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Moodle is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Moodle. If not, see