Move resource loader definition to skin.json

Now `wvui` is in core, there is no need for this to be conditional.

Depends-On: I91db16946e7ea46f69a6b57b116962f77ce3cd20
Change-Id: Icceaefc63d227ca772a986ad2c6ce28cbdb0a7d6
This commit is contained in:
jdlrobson 2021-02-11 16:50:31 -08:00 committed by Jdlrobson
parent fdd713b244
commit 4035d3575f
2 changed files with 20 additions and 42 deletions

View File

@ -6,7 +6,6 @@ use Config;
use HTMLForm;
use MediaWiki\MediaWikiServices;
use OutputPage;
use ResourceLoader;
use ResourceLoaderContext;
use Skin;
use SkinTemplate;
@ -390,44 +389,4 @@ class Hooks {
private static function isSkinVersionLegacy(): bool {
return !VectorServices::getFeatureManager()->isFeatureEnabled( Constants::FEATURE_LATEST_SKIN );
}
/**
* ResourceLoaderRegisterModules hook handler
*
* Register the new search module.
* This hook will be removed when wvui is available in core when the patch
* https://gerrit.wikimedia.org/r/c/mediawiki/core/+/641052 is merged.
*
* @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderRegisterModules
* @param ResourceLoader $rl
*/
public static function onResourceLoaderRegisterModules( ResourceLoader $rl ) {
if ( $rl->isModuleRegistered( 'wvui' ) ) {
$module = [
'localBasePath' => __DIR__ . '/..',
'remoteExtPath' => 'Vector',
'dependencies' => [
'mediawiki.util',
],
"packageFiles" => [
"resources/skins.vector.search/skins.vector.search.js",
"resources/skins.vector.search/instrumentation.js",
"resources/skins.vector.search/App.vue",
[
"name" => "resources/skins.vector.search/config.json",
"callback" => "Vector\\Hooks::getVectorWvuiSearchResourceLoaderConfig"
]
],
"dependencies" => [
"wvui"
],
"messages" => [
"search",
"searchresults",
"searchsuggest-containing"
],
];
$rl->register( 'skins.vector.search', $module );
}
}
}

View File

@ -68,7 +68,6 @@
"SkinPageReadyConfig": "Vector\\Hooks::onSkinPageReadyConfig",
"GetPreferences": "Vector\\Hooks::onGetPreferences",
"PreferencesFormPreSave": "Vector\\Hooks::onPreferencesFormPreSave",
"ResourceLoaderRegisterModules": "Vector\\Hooks::onResourceLoaderRegisterModules",
"SkinTemplateNavigation::Universal": "Vector\\Hooks::onSkinTemplateNavigation",
"LocalUserCreated": "Vector\\Hooks::onLocalUserCreated",
"OutputPageBodyAttributes": "Vector\\Hooks::onOutputPageBodyAttributes",
@ -76,6 +75,26 @@
},
"@note": "When modifying skins.vector.styles definition, make sure the installer still works",
"ResourceModules": {
"skins.vector.search": {
"dependencies": [
"mediawiki.util",
"wvui"
],
"packageFiles": [
"resources/skins.vector.search/skins.vector.search.js",
"resources/skins.vector.search/instrumentation.js",
"resources/skins.vector.search/App.vue",
{
"name": "resources/skins.vector.search/config.json",
"callback": "Vector\\Hooks::getVectorWvuiSearchResourceLoaderConfig"
}
],
"messages": [
"search",
"searchresults",
"searchsuggest-containing"
]
},
"skins.vector.styles.legacy": {
"class": "ResourceLoaderSkinModule",
"features": {