MediaWiki  1.33.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  $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 
80  public function setupSkinUserCss( OutputPage $out ) {
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 }
SkinVector\setupSkinUserCss
setupSkinUserCss(OutputPage $out)
Loads skin and user CSS files.
Definition: SkinVector.php:80
SkinVector\$stylename
$stylename
Definition: SkinVector.php:31
SkinVector\$vectorConfig
Config $vectorConfig
Definition: SkinVector.php:36
SkinVector\$responsiveMode
$responsiveMode
Definition: SkinVector.php:37
$out
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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:780
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
Config
Interface for configuration instances.
Definition: Config.php:28
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:925
SkinVector\$template
$template
Definition: SkinVector.php:32
ContextSource\getOutput
getOutput()
Definition: ContextSource.php:112
SkinVector\getPageClasses
getPageClasses( $title)
@inheritDoc
Definition: SkinVector.php:45
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:96
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:66
SkinVector\shouldPreloadLogo
shouldPreloadLogo()
Whether the logo should be preloaded with an HTTP link header or not.
Definition: SkinVector.php:105
SkinVector\enableResponsiveMode
enableResponsiveMode()
Enables the responsive mode.
Definition: SkinVector.php:53
SkinTemplate
Base class for template-based skins.
Definition: SkinTemplate.php:38