MediaWiki master
SkinComponentEmailConfirmationBanner.php
Go to the documentation of this file.
1<?php
2
4
8
13
14 private EmailConfirmationBannerHandler $handler;
15 private IContextSource $context;
16
17 public function __construct(
19 IContextSource $context
20 ) {
21 $this->handler = $handler;
22 $this->context = $context;
23 }
24
26 public function getTemplateData(): array {
27 if ( !$this->handler->shouldShowBanner( $this->context->getUser(), $this->context->getTitle() ) ) {
28 return [ 'html' => '' ];
29 }
30
31 $out = $this->context->getOutput();
32 $out->addModuleStyles( 'mediawiki.codex.messagebox.styles' );
33 $out->addModules( 'mediawiki.emailConfirmationBanner.abTest' );
34
35 $armA = Html::rawElement(
36 'div',
37 [ 'class' => 'mw-emailconfirmbanner-container', 'data-arm' => 'arm_a', 'style' => 'display:none' ],
38 Html::warningBox( $this->context->msg( 'confirmemail-notice' )->parse(), 'mw-emailconfirmbanner' )
39 );
40
41 return [ 'html' => $armA ];
42 }
43}
if(!defined('MW_SETUP_CALLBACK'))
Definition WebStart.php:69
This class is a collection of static functions that serve two purposes:
Definition Html.php:44
Decides whether to show the email confirmation banner to a given user.
getTemplateData()
This returns all the data that is needed to the component.Returned array must be serialized....
__construct(EmailConfirmationBannerHandler $handler, IContextSource $context)
Interface for objects which can provide a MediaWiki context on request.