Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 24 |
|
0.00% |
0 / 10 |
CRAP | |
0.00% |
0 / 1 |
Help | |
0.00% |
0 / 24 |
|
0.00% |
0 / 10 |
110 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getModuleStyles | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
getHeader | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
2 | |||
getMobileSummaryHeader | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getHeaderText | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getSubheader | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getJsConfigVars | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getBody | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
getMobileSummaryBody | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
getHeaderIconName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace GrowthExperiments\HomepageModules; |
4 | |
5 | use GrowthExperiments\ExperimentUserManager; |
6 | use GrowthExperiments\HelpPanel; |
7 | use IContextSource; |
8 | use MediaWiki\Config\Config; |
9 | use MediaWiki\Html\Html; |
10 | |
11 | class Help extends BaseModule { |
12 | public const HELP_MODULE_QUESTION_TAG = 'help module question'; |
13 | |
14 | /** |
15 | * @inheritDoc |
16 | */ |
17 | public function __construct( |
18 | IContextSource $context, |
19 | Config $wikiConfig, |
20 | ExperimentUserManager $experimentUserManager |
21 | ) { |
22 | parent::__construct( 'help', $context, $wikiConfig, $experimentUserManager ); |
23 | } |
24 | |
25 | /** @inheritDoc */ |
26 | protected function getModuleStyles() { |
27 | return array_merge( |
28 | parent::getModuleStyles(), |
29 | [ 'oojs-ui.styles.icons-interactions' ] |
30 | ); |
31 | } |
32 | |
33 | /** @inheritDoc */ |
34 | public function getHeader() { |
35 | return $this->getHeaderIcon( |
36 | $this->getHeaderIconName(), |
37 | $this->shouldInvertHeaderIcon() |
38 | ) . $this->getHeaderTextElement(); |
39 | } |
40 | |
41 | /** @inheritDoc */ |
42 | protected function getMobileSummaryHeader() { |
43 | return $this->getHeaderTextElement(); |
44 | } |
45 | |
46 | /** |
47 | * @inheritDoc |
48 | */ |
49 | protected function getHeaderText() { |
50 | return $this->getContext()->msg( 'growthexperiments-homepage-help-header' )->text(); |
51 | } |
52 | |
53 | /** |
54 | * @inheritDoc |
55 | */ |
56 | protected function getSubheader() { |
57 | return $this->getContext()->msg( 'growthexperiments-homepage-help-subheader' )->escaped(); |
58 | } |
59 | |
60 | /** |
61 | * @inheritDoc |
62 | */ |
63 | protected function getJsConfigVars() { |
64 | return HelpPanel::getUserEmailConfigVars( $this->getContext()->getUser() ); |
65 | } |
66 | |
67 | /** |
68 | * @inheritDoc |
69 | */ |
70 | protected function getBody() { |
71 | $helpPanelLinkData = HelpPanel::getHelpPanelLinks( |
72 | $this->getContext(), |
73 | $this->getGrowthWikiConfig() |
74 | ); |
75 | return $helpPanelLinkData['helpPanelLinks'] . $helpPanelLinkData['viewMoreLink']; |
76 | } |
77 | |
78 | /** |
79 | * @inheritDoc |
80 | */ |
81 | protected function getMobileSummaryBody() { |
82 | return Html::element( |
83 | 'div', |
84 | [ 'class' => 'growthexperiments-homepage-module-text-light' ], |
85 | $this->getContext()->msg( 'growthexperiments-homepage-help-mobilebody' )->text() |
86 | ); |
87 | } |
88 | |
89 | /** |
90 | * @inheritDoc |
91 | */ |
92 | protected function getHeaderIconName() { |
93 | return 'help'; |
94 | } |
95 | } |