Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 25 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
Skin | |
0.00% |
0 / 25 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
initPage | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
setupTemplateForOutput | |
0.00% |
0 / 23 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | /** |
3 | * This program is free software; you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License as published by |
5 | * the Free Software Foundation; either version 2 of the License, or |
6 | * (at your option) any later version. |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License along |
14 | * with this program; if not, write to the Free Software Foundation, Inc., |
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
16 | * |
17 | * @file |
18 | */ |
19 | namespace MediaWiki\Skin\WikimediaApiPortal; |
20 | |
21 | use MediaWiki\Output\OutputPage; |
22 | use QuickTemplate; |
23 | use SkinTemplate; |
24 | |
25 | class Skin extends SkinTemplate { |
26 | /** @var string */ |
27 | public $skinname = 'wikimediaapiportal'; |
28 | /** @var string */ |
29 | public $template = WikimediaApiPortalTemplate::class; |
30 | |
31 | /** |
32 | * @param OutputPage $out |
33 | */ |
34 | public function initPage( OutputPage $out ) { |
35 | parent::initPage( $out ); |
36 | |
37 | // Enable responsive behaviour on mobile browsers |
38 | $out->addMeta( 'viewport', 'width=device-width, initial-scale=1, shrink-to-fit=no' ); |
39 | } |
40 | |
41 | /** @return QuickTemplate */ |
42 | protected function setupTemplateForOutput(): QuickTemplate { |
43 | $template = parent::setupTemplateForOutput(); |
44 | $template->set( 'skin', $this ); |
45 | |
46 | $output = $this->getOutput(); |
47 | $output->enableOOUI(); |
48 | $output->addModuleStyles( [ |
49 | 'oojs-ui.styles.icons-user', |
50 | 'oojs-ui.styles.icons-content', |
51 | 'oojs-ui.styles.icons-alerts', |
52 | 'oojs-ui.styles.icons-editing-core', |
53 | 'oojs-ui.styles.icons-editing-advanced', |
54 | 'oojs-ui.styles.icons-interactions', |
55 | 'oojs-ui.styles.icons-layout', |
56 | 'oojs-ui.styles.icons-movement', |
57 | 'oojs-ui.styles.icons-wikimedia', |
58 | 'skin.wikimediaapiportal.styles' |
59 | ] ); |
60 | $output->addModules( "skin.wikimediaapiportal.scripts" ); |
61 | if ( $this->getTitle()->isMainPage() && |
62 | ( $this->getRequest()->getRawVal( 'action' ) ?? 'view' ) === 'view' ) { |
63 | $output->addModuleStyles( [ |
64 | "skin.wikimediaapiportal.mainpage", |
65 | ] ); |
66 | } |
67 | |
68 | return $template; |
69 | } |
70 | } |