mediawiki-skins-Vector/includes/ResourceLoader/VectorResourceLoaderUserModule.php
Sam Wilson c32c64481d Use new ResourceLoader namespace
To fix Phan errors with the now-deprecated ResourceLoaderContext
class alias.

Bug: T308718
Change-Id: Ifd265d29cee5f8a68e7b3036deaf2ba2b6c49d2e
2022-05-25 10:36:40 +00:00

24 lines
634 B
PHP

<?php
namespace MediaWiki\Skins\Vector\ResourceLoader;
use MediaWiki\ResourceLoader as RL;
use MediaWiki\Skins\Vector\Constants;
class VectorResourceLoaderUserModule extends RL\UserModule {
/**
* @inheritDoc
*/
protected function getPages( RL\Context $context ) {
$skin = $context->getSkin();
$config = $this->getConfig();
$user = $context->getUserObj();
$pages = [];
if ( $config->get( 'AllowUserCss' ) && !$user->isAnon() && ( $skin === Constants::SKIN_NAME_MODERN ) ) {
$userPage = $user->getUserPage()->getPrefixedDBkey();
$pages["$userPage/vector.js"] = [ 'type' => 'script' ];
}
return $pages;
}
}