MDL-74026 admin: consistently show search element on admin pages.
This commit is contained in:
+9
-1
@@ -8804,10 +8804,11 @@ function admin_externalpage_setup($section, $extrabutton = '', array $extraurlpa
|
||||
$adminroot = admin_get_root(false, false); // settings not required for external pages
|
||||
$extpage = $adminroot->locate($section, true);
|
||||
|
||||
$hassiteconfig = has_capability('moodle/site:config', context_system::instance());
|
||||
if (empty($extpage) or !($extpage instanceof admin_externalpage)) {
|
||||
// The requested section isn't in the admin tree
|
||||
// It could be because the user has inadequate capapbilities or because the section doesn't exist
|
||||
if (!has_capability('moodle/site:config', context_system::instance())) {
|
||||
if (!$hassiteconfig) {
|
||||
// The requested section could depend on a different capability
|
||||
// but most likely the user has inadequate capabilities
|
||||
print_error('accessdenied', 'admin');
|
||||
@@ -8878,6 +8879,13 @@ function admin_externalpage_setup($section, $extrabutton = '', array $extraurlpa
|
||||
$PAGE->set_title("$SITE->shortname: " . implode(": ", $visiblepathtosection));
|
||||
$PAGE->set_heading($SITE->fullname);
|
||||
|
||||
if ($hassiteconfig) {
|
||||
$PAGE->add_header_action($OUTPUT->render_from_template('core_admin/header_search_input', [
|
||||
'action' => new moodle_url('/admin/search.php'),
|
||||
'query' => $PAGE->url->get_param('query'),
|
||||
]));
|
||||
}
|
||||
|
||||
// prevent caching in nav block
|
||||
$PAGE->navigation->clear_cache();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user