mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-23 22:03:39 +00:00
Merge "Inject service 'Minerva.LanguagesHelper' into SkinMinerva"
This commit is contained in:
commit
e46e0bbf6f
|
@ -28,6 +28,7 @@ use MediaWiki\Html\Html;
|
|||
use MediaWiki\Linker\LinkRenderer;
|
||||
use MediaWiki\Linker\LinkTarget;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
use MediaWiki\Minerva\LanguagesHelper;
|
||||
use MediaWiki\Minerva\Menu\Main\MainMenuDirector;
|
||||
use MediaWiki\Minerva\Menu\PageActions\PageActionsDirector;
|
||||
use MediaWiki\Minerva\Menu\User\UserMenuDirector;
|
||||
|
@ -68,6 +69,8 @@ class SkinMinerva extends SkinMustache {
|
|||
|
||||
private LinkRenderer $linkRenderer;
|
||||
|
||||
private LanguagesHelper $languagesHelper;
|
||||
|
||||
private IMinervaPagePermissions $permissions;
|
||||
|
||||
private SkinOptions $skinOptions;
|
||||
|
@ -81,6 +84,7 @@ class SkinMinerva extends SkinMustache {
|
|||
/**
|
||||
* @param GenderCache $genderCache
|
||||
* @param LinkRenderer $linkRenderer
|
||||
* @param LanguagesHelper $languagesHelper
|
||||
* @param MinervaPagePermissions $permissions
|
||||
* @param SkinOptions $skinOptions
|
||||
* @param NamespaceInfo $namespaceInfo
|
||||
|
@ -91,6 +95,7 @@ class SkinMinerva extends SkinMustache {
|
|||
public function __construct(
|
||||
GenderCache $genderCache,
|
||||
LinkRenderer $linkRenderer,
|
||||
LanguagesHelper $languagesHelper,
|
||||
MinervaPagePermissions $permissions,
|
||||
SkinOptions $skinOptions,
|
||||
NamespaceInfo $namespaceInfo,
|
||||
|
@ -101,6 +106,7 @@ class SkinMinerva extends SkinMustache {
|
|||
parent::__construct( $options );
|
||||
$this->genderCache = $genderCache;
|
||||
$this->linkRenderer = $linkRenderer;
|
||||
$this->languagesHelper = $languagesHelper;
|
||||
$this->permissions = $permissions
|
||||
->setContext( $this->getContext() );
|
||||
$this->skinOptions = $skinOptions;
|
||||
|
@ -949,9 +955,6 @@ class SkinMinerva extends SkinMustache {
|
|||
return null;
|
||||
}
|
||||
|
||||
$services = MediaWikiServices::getInstance();
|
||||
/** @var \MediaWiki\Minerva\LanguagesHelper $languagesHelper */
|
||||
$languagesHelper = $services->getService( 'Minerva.LanguagesHelper' );
|
||||
$buttons = [];
|
||||
// always add a button to link to the talk page
|
||||
// it will link to the wikitext talk page
|
||||
|
@ -980,7 +983,7 @@ class SkinMinerva extends SkinMustache {
|
|||
}
|
||||
|
||||
if (
|
||||
$languagesHelper->doesTitleHasLanguagesOrVariants( $this->getOutput(), $title ) &&
|
||||
$this->languagesHelper->doesTitleHasLanguagesOrVariants( $this->getOutput(), $title ) &&
|
||||
$title->isMainPage()
|
||||
) {
|
||||
$buttons['language'] = $this->getLanguageButton();
|
||||
|
|
|
@ -119,6 +119,7 @@
|
|||
"services": [
|
||||
"GenderCache",
|
||||
"LinkRenderer",
|
||||
"Minerva.LanguagesHelper",
|
||||
"Minerva.Permissions",
|
||||
"Minerva.SkinOptions",
|
||||
"NamespaceInfo",
|
||||
|
|
|
@ -41,6 +41,7 @@ class SkinMinervaTest extends MediaWikiIntegrationTestCase {
|
|||
return new SkinMinerva(
|
||||
$services->getGenderCache(),
|
||||
$services->getLinkRenderer(),
|
||||
$services->getService( 'Minerva.LanguagesHelper' ),
|
||||
$services->getService( 'Minerva.Permissions' ),
|
||||
$services->getService( 'Minerva.SkinOptions' ),
|
||||
$services->getNamespaceInfo(),
|
||||
|
|
Loading…
Reference in a new issue