MediaWiki REL1_34
SkinVector.php
Go to the documentation of this file.
1<?php
29class SkinVector extends SkinTemplate {
30 public $skinname = 'vector';
31 public $stylename = 'Vector';
32 public $template = 'VectorTemplate';
37 private $responsiveMode = false;
38
39 public function __construct() {
40 parent::__construct( ...func_get_args() );
41 $this->vectorConfig = \MediaWiki\MediaWikiServices::getInstance()->getConfigFactory()
42 ->makeConfig( 'vector' );
43 }
44
46 public function getPageClasses( $title ) {
47 $className = parent::getPageClasses( $title );
48 return $className;
49 }
50
54 public function enableResponsiveMode() {
55 if ( !$this->responsiveMode ) {
56 $out = $this->getOutput();
57 $out->addMeta( 'viewport', 'width=device-width, initial-scale=1' );
58 $out->addModuleStyles( 'skins.vector.styles.responsive' );
59 $this->responsiveMode = true;
60 }
61 }
62
67 public function initPage( OutputPage $out ) {
68 parent::initPage( $out );
69
70 if ( $this->vectorConfig->get( 'VectorResponsive' ) ) {
71 $this->enableResponsiveMode();
72 }
73
74 $out->addModules( 'skins.vector.js' );
75 }
76
81 public function setupSkinUserCss( OutputPage $out ) {
82 parent::setupSkinUserCss( $out );
83
84 $out->addModuleStyles( [
85 'mediawiki.skinning.interface',
86 'skins.vector.styles',
87 ] );
88 }
89
97 public function setupTemplate( $classname, $repository = false, $cache_dir = false ) {
98 return new $classname( $this->vectorConfig );
99 }
100
106 public function shouldPreloadLogo() {
107 return true;
108 }
109}
This is one of the Core classes and should be read at least once by any new developers.
addModuleStyles( $modules)
Load the styles of one or more ResourceLoader modules on this page.
addModules( $modules)
Load one or more ResourceLoader modules on this page.
Base class for template-based skins.
Skin subclass for Vector.
setupTemplate( $classname, $repository=false, $cache_dir=false)
Override to pass our Config instance to it.
setupSkinUserCss(OutputPage $out)
Loads skin and user CSS files.
initPage(OutputPage $out)
Initializes output page and sets up skin-specific parameters.
enableResponsiveMode()
Enables the responsive mode.
shouldPreloadLogo()
Whether the logo should be preloaded with an HTTP link header or not.
Config $vectorConfig
getPageClasses( $title)
TODO: document.string
Interface for configuration instances.
Definition Config.php:28