MediaWiki  1.34.0
SkinVector.php
Go to the documentation of this file.
1 <?php
29 class SkinVector extends SkinTemplate {
30  public $skinname = 'vector';
31  public $stylename = 'Vector';
32  public $template = 'VectorTemplate';
36  private $vectorConfig;
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 }
SkinVector\setupSkinUserCss
setupSkinUserCss(OutputPage $out)
Loads skin and user CSS files.
Definition: SkinVector.php:81
SkinVector\$stylename
$stylename
Definition: SkinVector.php:31
SkinVector\$vectorConfig
Config $vectorConfig
Definition: SkinVector.php:36
SkinVector\$responsiveMode
$responsiveMode
Definition: SkinVector.php:37
Config
Interface for configuration instances.
Definition: Config.php:28
SkinVector\$template
$template
Definition: SkinVector.php:32
ContextSource\getOutput
getOutput()
Definition: ContextSource.php:112
SkinVector\getPageClasses
getPageClasses( $title)
TODO: document.string
Definition: SkinVector.php:46
$title
$title
Definition: testCompression.php:34
SkinVector\$skinname
$skinname
Definition: SkinVector.php:30
SkinVector\setupTemplate
setupTemplate( $classname, $repository=false, $cache_dir=false)
Override to pass our Config instance to it.
Definition: SkinVector.php:97
SkinVector\__construct
__construct()
Definition: SkinVector.php:39
SkinVector
Skin subclass for Vector.
Definition: SkinVector.php:29
SkinVector\initPage
initPage(OutputPage $out)
Initializes output page and sets up skin-specific parameters.
Definition: SkinVector.php:67
SkinVector\shouldPreloadLogo
shouldPreloadLogo()
Whether the logo should be preloaded with an HTTP link header or not.
Definition: SkinVector.php:106
SkinVector\enableResponsiveMode
enableResponsiveMode()
Enables the responsive mode.
Definition: SkinVector.php:54
SkinTemplate
Base class for template-based skins.
Definition: SkinTemplate.php:38