Use standard getJsConfigVars method

Depends-On:  I1e2927a5ced077c8764ff7872ca033f487ae7cc7
Change-Id: Ia5aae659d9882bef7a273c709789437719303a35
This commit is contained in:
jdlrobson 2020-04-21 15:44:18 -07:00 committed by Jdlrobson
parent 8cb8a3cd3a
commit fa6255dfd0
2 changed files with 5 additions and 17 deletions

View file

@ -314,7 +314,7 @@ class MinervaHooks {
* ResourceLoaderGetConfigVars hook handler.
* Used for setting JS variables which are pulled in dynamically with RL
* instead of embedded directly on the page with a script tag.
* These vars have a shorter cache-life than those in `getSkinConfigVariables`.
* These vars have a shorter cache-life than those in `getJsConfigVars`.
*
* @param array &$vars Array of variables to be added into the output of the RL startup module.
* @param string $skin

View file

@ -294,15 +294,6 @@ class SkinMinerva extends SkinTemplate {
return MediaWikiServices::getInstance()->getService( 'Minerva.SkinUserPageHelper' );
}
/**
* Initializes output page and sets up skin-specific parameters
* @param OutputPage $out object to initialize
*/
public function initPage( OutputPage $out ) {
parent::initPage( $out );
$out->addJsConfigVars( $this->getSkinConfigVariables() );
}
/**
* Prepares the user button.
* @param QuickTemplate $tpl
@ -723,14 +714,13 @@ class SkinMinerva extends SkinTemplate {
}
/**
* Returns array of config variables that should be added only to this skin
* for use in JavaScript.
* @inheritDoc
* @return array
*/
public function getSkinConfigVariables() {
protected function getJsConfigVars() : array {
$title = $this->getTitle();
$vars = [
return array_merge( parent::getJsConfigVars(), [
'wgMinervaPermissions' => [
'watch' => $this->getPermissions()->isAllowed( IMinervaPagePermissions::WATCH ),
'talk' => $this->getUserPageHelper()->isUserPage() ||
@ -739,9 +729,7 @@ class SkinMinerva extends SkinTemplate {
],
'wgMinervaFeatures' => $this->skinOptions->getAll(),
'wgMinervaDownloadNamespaces' => $this->getConfig()->get( 'MinervaDownloadNamespaces' ),
];
return $vars;
] );
}
/**