Disable core search module using search config

This commit is contained in:
alistair3149 2020-08-21 15:38:11 -04:00
parent 0b87fa8641
commit 331d7c9508
No known key found for this signature in database
GPG key ID: 94D081060FD3DD9C
2 changed files with 25 additions and 0 deletions

View file

@ -26,6 +26,7 @@ use ConfigException;
use Exception;
use MediaWiki\MediaWikiServices;
use RequestContext;
use ResourceLoaderContext;
use ThumbnailImage;
/**
@ -66,6 +67,29 @@ class CitizenHooks {
return true;
}
/**
* SkinPageReadyConfig hook handler
*
* Replace searchModule provided by skin.
*
* @since 1.35
* @param ResourceLoaderContext $context
* @param mixed[] &$config Associative array of configurable options
* @return void This hook must not abort, it must return no value
*/
public static function onSkinPageReadyConfig(
ResourceLoaderContext $context,
array &$config
) {
// It's better to exit before any additional check
if ( $context->getSkin() !== 'citizen' ) {
return;
}
// Tell the `mediawiki.page.ready` module not to wire up search.
$config['search'] = false;
}
/**
* Lazyload images
* Modified from the Lazyload extension

View file

@ -65,6 +65,7 @@
},
"Hooks": {
"ResourceLoaderGetConfigVars": "Citizen\\CitizenHooks::onResourceLoaderGetConfigVars",
"SkinPageReadyConfig": "Citizen\\CitizenHooks::onSkinPageReadyConfig",
"ThumbnailBeforeProduceHTML": "Citizen\\CitizenHooks::onThumbnailBeforeProduceHTML"
},
"ResourceModules": {