Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 25
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
Skin
0.00% covered (danger)
0.00%
0 / 25
0.00% covered (danger)
0.00%
0 / 2
20
0.00% covered (danger)
0.00%
0 / 1
 initPage
0.00% covered (danger)
0.00%
0 / 2
0.00% covered (danger)
0.00%
0 / 1
2
 setupTemplateForOutput
0.00% covered (danger)
0.00%
0 / 23
0.00% covered (danger)
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 */
19namespace MediaWiki\Skin\WikimediaApiPortal;
20
21use MediaWiki\Output\OutputPage;
22use QuickTemplate;
23use SkinTemplate;
24
25class Skin extends SkinTemplate {
26    public $skinname = 'wikimediaapiportal';
27    public $template = WikimediaApiPortalTemplate::class;
28
29    /**
30     * @param OutputPage $out
31     */
32    public function initPage( OutputPage $out ) {
33        parent::initPage( $out );
34
35        // Enable responsive behaviour on mobile browsers
36        $out->addMeta( 'viewport', 'width=device-width, initial-scale=1, shrink-to-fit=no' );
37    }
38
39    /** @return QuickTemplate */
40    protected function setupTemplateForOutput(): QuickTemplate {
41        $template = parent::setupTemplateForOutput();
42        $template->set( 'skin', $this );
43
44        $output = $this->getOutput();
45        $output->enableOOUI();
46        $output->addModuleStyles( [
47            'oojs-ui.styles.icons-user',
48            'oojs-ui.styles.icons-content',
49            'oojs-ui.styles.icons-alerts',
50            'oojs-ui.styles.icons-editing-core',
51            'oojs-ui.styles.icons-editing-advanced',
52            'oojs-ui.styles.icons-interactions',
53            'oojs-ui.styles.icons-layout',
54            'oojs-ui.styles.icons-movement',
55            'oojs-ui.styles.icons-wikimedia',
56            'skin.wikimediaapiportal.styles'
57        ] );
58        $output->addModules( "skin.wikimediaapiportal.scripts" );
59        if ( $this->getTitle()->isMainPage() &&
60            $this->getRequest()->getRawVal( 'action', 'view' ) === 'view' ) {
61            $output->addModuleStyles( [
62                "skin.wikimediaapiportal.mainpage",
63            ] );
64        }
65
66        return $template;
67    }
68}