mediawiki-skins-Vector/includes/Components/VectorComponentMainMenuActionLanguageSwitchAlert.php
Jon Robson 6636367d47 [Components] Introduce VectorComponent and MainMenu components
To aid moving towards a MainMenu component we must first make subcomponents
for the language alert and opt-out link (which share code which
I've captured in VectorComponentMainMenuAction)

Code is lifted into SkinVector22 to allow us to easily make the template
change without any breaking visual changes

Bug: T319349
Bug: T322089
Change-Id: Ibb69d029a9fb6cee3482e15a60a7358361bd2405
2022-11-01 17:01:51 -07:00

42 lines
868 B
PHP

<?php
namespace MediaWiki\Skins\Vector\Components;
use Html;
use Skin;
/**
* VectorComponentMainMenuActionLanguageSwitchAlert component
*/
class VectorComponentMainMenuActionLanguageSwitchAlert implements VectorComponent {
/** @var Skin */
private $skin;
/**
* @param Skin $skin
*/
public function __construct( Skin $skin ) {
$this->skin = $skin;
}
/**
* @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(
$skin, $languageSwitchAlert, $headingOptions
);
return $component->getTemplateData();
}
}