Get ResourceLoader from Context

Change-Id: I439266105ef18612da50a3d306b04a835c648eae
This commit is contained in:
Fomafix 2024-03-23 08:38:13 +00:00
parent fc9c41ee05
commit 61c539d205

View file

@ -25,9 +25,9 @@ use MediaWiki\Auth\Hook\LocalUserCreatedHook;
use MediaWiki\Config\Config;
use MediaWiki\Hook\BeforePageDisplayHook;
use MediaWiki\Hook\MakeGlobalVariablesScriptHook;
use MediaWiki\MediaWikiServices;
use MediaWiki\Output\OutputPage;
use MediaWiki\Preferences\Hook\GetPreferencesHook;
use MediaWiki\ResourceLoader\Context;
use MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook;
use MediaWiki\User\Hook\UserGetDefaultOptionsHook;
use MediaWiki\User\Options\UserOptionsManager;
@ -83,13 +83,13 @@ class PopupsHooks implements
/**
* Get custom Popups types registered by extensions
* @param Context $context
* @return array
*/
public static function getCustomPopupTypes(): array {
$rl = MediaWikiServices::getInstance()->getService( 'ResourceLoader' );
public static function getCustomPopupTypes( Context $context ): array {
// FIXME: If the module ext.cite.referencePreviews does not exist register reference previews.
// This code can be removed once T355194 is complete.
$others = $rl->getModule( 'ext.cite.referencePreviews' ) ?
$others = $context->getResourceLoader()->getModule( 'ext.cite.referencePreviews' ) ?
[] : [ 'ext.popups.referencePreviews' ];
return array_merge( ExtensionRegistry::getInstance()->getAttribute(