mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/Vector.git
synced 2024-11-15 03:34:25 +00:00
f8ffcd20d2
Changes to the use statements done automatically via script Addition of missing use statements done manually Change-Id: I9b8f447ea4d715bc815cc782184bca288ee001a0
47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
|
namespace MediaWiki\Skins\Vector\Components;
|
|
|
|
use MediaWiki\Html\Html;
|
|
use Skin;
|
|
|
|
/**
|
|
* VectorComponentMainMenuActionLanguageSwitchAlert component
|
|
*/
|
|
class VectorComponentMainMenuActionLanguageSwitchAlert implements VectorComponent {
|
|
/** @var Skin */
|
|
private $skin;
|
|
/** @var int */
|
|
private $numLanguages;
|
|
|
|
/**
|
|
* @param Skin $skin
|
|
* @param int $numLanguages
|
|
*/
|
|
public function __construct( Skin $skin, int $numLanguages ) {
|
|
$this->skin = $skin;
|
|
$this->numLanguages = $numLanguages;
|
|
}
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function getTemplateData(): array {
|
|
$skin = $this->skin;
|
|
$languageSwitchAlert = [
|
|
'html-content' => Html::noticeBox(
|
|
$skin->msg( 'vector-language-redirect-to-top' )->parse(),
|
|
'vector-language-sidebar-alert'
|
|
),
|
|
];
|
|
$headingOptions = [
|
|
'heading' => $skin->msg( 'vector-languages' )->plain(),
|
|
];
|
|
|
|
$component = new VectorComponentMainMenuAction(
|
|
'lang-alert', $skin, $languageSwitchAlert, $headingOptions,
|
|
( $this->numLanguages === 0 ? 'vector-main-menu-action-lang-alert-empty' : '' )
|
|
);
|
|
return $component->getTemplateData();
|
|
}
|
|
}
|