mediawiki-skins-Vector/includes/ResourceLoader/VectorResourceLoaderUserModule.php
Jon Robson 9fba9b6b9e Do not load common.js twice
An error in both of these modules. This module is additive (it doesn't
replace the existing user module) so only needs to add new pages, not
append to existing pages.

Bug: T300070
Change-Id: I3ba2ce82ba924972d0f9fea763328510aef41f8e
2022-01-25 20:10:31 +00:00

25 lines
645 B
PHP

<?php
namespace Vector\ResourceLoader;
use ResourceLoaderContext;
use ResourceLoaderUserModule;
use Vector\Constants;
class VectorResourceLoaderUserModule extends ResourceLoaderUserModule {
/**
* @inheritDoc
*/
protected function getPages( ResourceLoaderContext $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;
}
}