Hygiene: remove vectorConfig and use the getConfig
The SkinVector implements IContextSource, thus it has to provide the getConfig() method. Vector skin is currently using it's own `vectorConfig` in one place and it passes the VectorConfig to the VectorTemplate class. Sadly the VectorConfig is the same thing what $this->getConfig() provides. There is no need to make this code more complex by handling two different config containers which at the end are the same GlobalVarConfig instances. If we decide to handle VectorConfigs differently, let's thing it through, for now we should simplify code and remove all uncessary logic. Thanks to that, there is also no need to override the setupTemplate(). Change-Id: I89c8a77f7d96f867c8c72e61f9e104e14d9512d9
This commit is contained in:
parent
6ce3b83954
commit
02d4e4929f
|
@ -30,17 +30,8 @@ class SkinVector extends SkinTemplate {
|
|||
public $skinname = 'vector';
|
||||
public $stylename = 'Vector';
|
||||
public $template = 'VectorTemplate';
|
||||
/**
|
||||
* @var Config
|
||||
*/
|
||||
private $vectorConfig;
|
||||
private $responsiveMode = false;
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct( ...func_get_args() );
|
||||
$this->vectorConfig = \MediaWiki\MediaWikiServices::getInstance()->getConfigFactory()
|
||||
->makeConfig( 'vector' );
|
||||
}
|
||||
private $responsiveMode = false;
|
||||
|
||||
/** @inheritDoc */
|
||||
public function getPageClasses( $title ) {
|
||||
|
@ -67,7 +58,7 @@ class SkinVector extends SkinTemplate {
|
|||
public function initPage( OutputPage $out ) {
|
||||
parent::initPage( $out );
|
||||
|
||||
if ( $this->vectorConfig->get( 'VectorResponsive' ) ) {
|
||||
if ( $this->getConfig()->get( 'VectorResponsive' ) ) {
|
||||
$this->enableResponsiveMode();
|
||||
}
|
||||
|
||||
|
@ -87,17 +78,6 @@ class SkinVector extends SkinTemplate {
|
|||
] );
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to pass our Config instance to it
|
||||
* @param string $classname
|
||||
* @param bool|string $repository
|
||||
* @param bool|string $cache_dir
|
||||
* @return QuickTemplate
|
||||
*/
|
||||
public function setupTemplate( $classname, $repository = false, $cache_dir = false ) {
|
||||
return new $classname( $this->vectorConfig );
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the logo should be preloaded with an HTTP link header or not
|
||||
* @since 1.29
|
||||
|
|
Loading…
Reference in New Issue