Localisation updates from https://translatewiki.net.
[mediawiki-sidebar-patch] / SkinVector.php
1 <?php
2 /**
3 * Vector - Modern version of MonoBook with fresh look and many usability
4 * improvements.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * http://www.gnu.org/copyleft/gpl.html
20 *
21 * @file
22 * @ingroup Skins
23 */
24
25 /**
26 * SkinTemplate class for Vector skin
27 * @ingroup Skins
28 */
29 class SkinVector extends SkinTemplate {
30 public $skinname = 'vector';
31 public $stylename = 'Vector';
32 public $template = 'VectorTemplate';
33 /**
34 * @var Config
35 */
36 private $vectorConfig;
37
38 public function __construct() {
39 $this->vectorConfig = ConfigFactory::getDefaultInstance()->makeConfig( 'vector' );
40 }
41
42 /**
43 * Initializes output page and sets up skin-specific parameters
44 * @param OutputPage $out Object to initialize
45 */
46 public function initPage( OutputPage $out ) {
47 parent::initPage( $out );
48
49 if ( $this->vectorConfig->get( 'VectorResponsive' ) ) {
50 $out->addMeta( 'viewport', 'width=device-width, initial-scale=1' );
51 $out->addModuleStyles( 'skins.vector.styles.responsive' );
52 }
53
54 $out->addModules( 'skins.vector.js' );
55 }
56
57 /**
58 * Loads skin and user CSS files.
59 * @param OutputPage $out
60 */
61 function setupSkinUserCss( OutputPage $out ) {
62 parent::setupSkinUserCss( $out );
63
64 $styles = [ 'mediawiki.skinning.interface', 'skins.vector.styles' ];
65 Hooks::run( 'SkinVectorStyleModules', [ $this, &$styles ] );
66 $out->addModuleStyles( $styles );
67 }
68
69 /**
70 * Override to pass our Config instance to it
71 */
72 public function setupTemplate( $classname, $repository = false, $cache_dir = false ) {
73 return new $classname( $this->vectorConfig );
74 }
75 }