| 1 |
<?php |
| 2 |
namespace MediaWiki\Skins\Vector\Components; |
| 3 |
|
| 4 |
use MediaWiki\SpecialPage\SpecialPage; |
| 5 |
use Skin; |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
class VectorComponentMainMenuActionOptOut implements VectorComponent { |
| 11 |
|
| 12 |
private $skin; |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
private const OPT_OUT_LINK_TRACKING_CODE = 'vctw1'; |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
public function __construct( Skin $skin ) { |
| 30 |
$this->skin = $skin; |
| 31 |
} |
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
public function getTemplateData(): array { |
| 37 |
$skin = $this->skin; |
| 38 |
|
| 39 |
$optOutUrl = [ |
| 40 |
'text' => $skin->msg( 'vector-opt-out' )->text(), |
| 41 |
'href' => SpecialPage::getTitleFor( |
| 42 |
'Preferences', |
| 43 |
false, |
| 44 |
'mw-prefsection-rendering-skin' |
| 45 |
)->getLinkURL( 'useskin=vector&wprov=' . self::OPT_OUT_LINK_TRACKING_CODE ), |
| 46 |
'title' => $skin->msg( 'vector-opt-out-tooltip' )->text(), |
| 47 |
'active' => false, |
| 48 |
]; |
| 49 |
$htmlData = [ |
| 50 |
'link' => $optOutUrl, |
| 51 |
]; |
| 52 |
$component = new VectorComponentMainMenuAction( 'opt-out', $skin, $htmlData, [] ); |
| 53 |
return $component->getTemplateData(); |
| 54 |
} |
| 55 |
} |