mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-24 23:55:53 +00:00
99cf6eb5be
For vector-2022 skin: * MediaWiki:Vector.css and MediaWiki:Vector.js are added via the existing ResourceLoader hook. * User:<name>/vector.js and User:<name>/vector.css are added via new VectorResourceLoader modules Bug: T297758 Change-Id: I37e9a9d353695502213c7a651530995252d9505f
26 lines
705 B
PHP
26 lines
705 B
PHP
<?php
|
|
|
|
namespace Vector\ResourceLoader;
|
|
|
|
use ResourceLoaderContext;
|
|
use ResourceLoaderUserStylesModule;
|
|
use Vector\Constants;
|
|
|
|
class VectorResourceLoaderUserStylesModule extends ResourceLoaderUserStylesModule {
|
|
/**
|
|
* @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 ) ) {
|
|
$pages = parent::getPages( $context );
|
|
$userPage = $user->getUserPage()->getPrefixedDBkey();
|
|
$pages["$userPage/vector.css"] = [ 'type' => 'style' ];
|
|
}
|
|
return $pages;
|
|
}
|
|
}
|