Provide standard way for skins to add JS config variables to page

Both Vector and Minerva add JS config variables. We should provide
a standard function for skins to override to do this.

This will be shortly used in Vector
(Ic9d54de7e19ef8d5dfd703d95a45b78c0aaf791a)
and immediately in Minerva
(Ia5aae659d9882bef7a273c709789437719303a35)

Change-Id: I1e2927a5ced077c8764ff7872ca033f487ae7cc7
This commit is contained in:
jdlrobson 2020-04-21 15:39:00 -07:00 committed by Jdlrobson
parent 9fb58e3db4
commit 1f5baae0a3

View file

@ -215,6 +215,7 @@ class SkinTemplate extends Skin {
$out = $this->getOutput();
$this->initPage( $out );
$out->addJsConfigVars( $this->getJsConfigVars() );
$tpl = $this->prepareQuickTemplate();
// execute template
$res = $tpl->execute();
@ -223,6 +224,17 @@ class SkinTemplate extends Skin {
$this->printOrError( $res );
}
/**
* Returns array of config variables that should be added only to this skin
* for use in JavaScript.
* Skins can override this to add variables to the page.
* @since 1.35
* @return array
*/
protected function getJsConfigVars() : array {
return [];
}
/**
* Wrap the body text with language information and identifiable element
*