mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-14 19:26:42 +00:00
b74b33f1f1
Context::getUserIdentity was added with 6fbea844 Change-Id: I3d590b1b104af804edeb91dc58155a54114aa4ba
33 lines
951 B
PHP
33 lines
951 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Skins\Vector\ResourceLoader;
|
|
|
|
use MediaWiki\MainConfigNames;
|
|
use MediaWiki\MediaWikiServices;
|
|
use MediaWiki\ResourceLoader as RL;
|
|
use MediaWiki\Skins\Vector\Constants;
|
|
use MediaWiki\Title\TitleValue;
|
|
|
|
class VectorResourceLoaderUserStylesModule extends RL\UserStylesModule {
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
protected function getPages( RL\Context $context ) {
|
|
$user = $context->getUserIdentity();
|
|
if ( !$user || !$user->isRegistered() ) {
|
|
return [];
|
|
}
|
|
$pages = [];
|
|
$config = $this->getConfig();
|
|
if ( $context->getSkin() === Constants::SKIN_NAME_MODERN &&
|
|
$config->get( 'VectorShareUserScripts' ) &&
|
|
$config->get( MainConfigNames::AllowUserCss )
|
|
) {
|
|
$titleFormatter = MediaWikiServices::getInstance()->getTitleFormatter();
|
|
$userPage = $titleFormatter->getPrefixedDBkey( new TitleValue( NS_USER, $user->getName() ) );
|
|
$pages["$userPage/vector.css"] = [ 'type' => 'style' ];
|
|
}
|
|
return $pages;
|
|
}
|
|
}
|