MediaWiki REL1_32
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 $this->vectorConfig = \MediaWiki\MediaWikiServices::getInstance()->getConfigFactory()
41 ->makeConfig( 'vector' );
42 }
43
45 public function getPageClasses( $title ) {
46 $className = parent::getPageClasses( $title );
47 return $className;
48 }
49
53 public function enableResponsiveMode() {
54 if ( !$this->responsiveMode ) {
55 $out = $this->getOutput();
56 $out->addMeta( 'viewport', 'width=device-width, initial-scale=1' );
57 $out->addModuleStyles( 'skins.vector.styles.responsive' );
58 $this->responsiveMode = true;
59 }
60 }
61
66 public function initPage( OutputPage $out ) {
67 parent::initPage( $out );
68
69 if ( $this->vectorConfig->get( 'VectorResponsive' ) ) {
70 $this->enableResponsiveMode();
71 }
72
73 $out->addModules( 'skins.vector.js' );
74 }
75
81 parent::setupSkinUserCss( $out );
82
83 $out->addModuleStyles( [
84 'mediawiki.skinning.interface',
85 'skins.vector.styles',
86 ] );
87 }
88
96 public function setupTemplate( $classname, $repository = false, $cache_dir = false ) {
97 return new $classname( $this->vectorConfig );
98 }
99
105 public function shouldPreloadLogo() {
106 return true;
107 }
108}
This class should be covered by a general architecture document which does not exist as of January 20...
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)
@inheritDoc
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping $template
Definition hooks.txt:861
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition hooks.txt:894
Interface for configuration instances.
Definition Config.php:28