MDL-74596 core_admin: option to hide search input on admin pages

This commit is contained in:
Marina Glancy 2022-05-31 15:54:04 +02:00
parent 9ccda59e00
commit b2565dd580
3 changed files with 4 additions and 2 deletions

View File

@ -8785,6 +8785,7 @@ class admin_setting_managecontentbankcontenttypes extends admin_setting {
* page (e.g. admin/roles/allow.php, instead of admin/roles/manage.php, you can pass the alternate URL here.
* @param array $options Additional options that can be specified for page setup.
* pagelayout - This option can be used to set a specific pagelyaout, admin is default.
* nosearch - Do not display search bar
*/
function admin_externalpage_setup($section, $extrabutton = '', array $extraurlparams = null, $actualurl = '', array $options = array()) {
global $CFG, $PAGE, $USER, $SITE, $OUTPUT;
@ -8881,7 +8882,7 @@ function admin_externalpage_setup($section, $extrabutton = '', array $extraurlpa
$PAGE->set_title("$SITE->shortname: " . implode(": ", $visiblepathtosection));
$PAGE->set_heading($SITE->fullname);
if ($hassiteconfig) {
if ($hassiteconfig && empty($options['nosearch'])) {
$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'),

View File

@ -30,6 +30,7 @@ information provided here is intended especially for developers.
attribute may encounter different behaviours between older Moodle versions (<v3.11.8, <v4.0.2) and the later ones. We recommend
plugin developers to not use this attribute for Moodle versions 4.0 and below in order to avoid this problem.
* Added $CFG->proxylogunsafe and proxyfixunsafe to detect code which doesn't honor the proxy config
* Function admin_externalpage_setup() now has additional option 'nosearch' allowing to remove Site administration search form.
=== 4.0 ===

View File

@ -47,7 +47,7 @@ $pagetitle = get_string('mypage', 'admin');
$PAGE->set_secondary_active_tab('appearance');
$PAGE->set_blocks_editing_capability('moodle/my:configsyspages');
$PAGE->set_url(new moodle_url('/my/indexsys.php'));
admin_externalpage_setup('mypage', '', null, '', array('pagelayout' => 'mydashboard'));
admin_externalpage_setup('mypage', '', null, '', ['pagelayout' => 'mydashboard', 'nosearch' => true]);
$PAGE->add_body_class('limitedwidth');
$PAGE->set_pagetype('my-index');
$PAGE->blocks->add_region('content');