jenkins-bot has submitted this change and it was merged.
Change subject: Use Config instead of globals
..
Use Config instead of globals
Change-Id: If6eac180316ef626e319fbd39988259dfcaffe16
---
M Truglass.php
M Truglass.skin.php
2 files changed, 20 insertions(+), 4 deletions(-)
Approvals:
Legoktm: Looks good to me, approved
jenkins-bot: Verified
diff --git a/Truglass.php b/Truglass.php
index 4936925..5c4e94c 100644
--- a/Truglass.php
+++ b/Truglass.php
@@ -39,6 +39,7 @@
// Autoload the skin class, make it a valid skin, set up i18n, set up CSS
// (via ResourceLoader)
$wgAutoloadClasses['SkinTruglass'] = __DIR__ . '/Truglass.skin.php';
+$wgConfigRegistry['truglass'] = 'GlobalVarConfig::newInstance';
$wgMessagesDirs['SkinTruglass'] = __DIR__ . '/i18n';
$wgResourceModules['skins.truglass'] = array(
'styles' = array(
diff --git a/Truglass.skin.php b/Truglass.skin.php
index 460b650..890c8ec 100644
--- a/Truglass.skin.php
+++ b/Truglass.skin.php
@@ -19,14 +19,29 @@
* Inherit main code from SkinTemplate, set the CSS and template filter.
*/
class SkinTruglass extends SkinTemplate {
- var $skinname = 'truglass', $stylename = 'truglass',
+ public $skinname = 'truglass', $stylename = 'truglass',
$template = 'TruglassTemplate', $useHeadElement = true;
+ /**
+* @var Config
+*/
+ private $truglassConfig;
+
+ public function __construct() {
+ $this-truglassConfig =
ConfigFactory::getDefaultInstance()-makeConfig( 'truglass' );
+ }
function setupSkinUserCss( OutputPage $out ) {
parent::setupSkinUserCss( $out );
// Add CSS
$out-addModuleStyles( 'skins.truglass' );
+ }
+
+ /**
+* Override to pass our Config instance to it
+*/
+ public function setupTemplate( $classname, $repository = false,
$cache_dir = false ) {
+ return new $classname( $this-truglassConfig );
}
}
@@ -340,9 +355,9 @@
* an array.
*/
function networkNavigationBox() {
- global $wgTruglassSidebarLinks;
+ $sidebarLinks = $this-config-get( 'TruglassSidebarLinks' );
- if( is_array( $wgTruglassSidebarLinks ) !empty(
$wgTruglassSidebarLinks ) ) {
+ if( is_array( $sidebarLinks ) !empty( $sidebarLinks ) ) {
?
div class=sbmodule
id=sbm-networknav
h4 class=sbmoduletitle
displayer?php echo wfMessage( 'truglass-links' )-parse() ?/h4
@@ -350,7 +365,7 @@
div class=stretcher
ul
?php
- foreach
( $wgTruglassSidebarLinks as $link = $title ) {
+ foreach
( $sidebarLinks as $link = $title ) {
echo 'lia href=http://' . $link . '/' . $title . '/a/li';
}
?
--
To view, visit https://gerrit.wikimedia.org/r/168912
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: If6eac180316ef626e319fbd39988259dfcaffe16
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/skins/Truglass
Gerrit-Branch: master
Gerrit-Owner: Lewis Cawte le...@lewiscawte.me
Gerrit-Reviewer: Legoktm legoktm.wikipe...@gmail.com
Gerrit-Reviewer: Lewis Cawte le...@lewiscawte.me
Gerrit-Reviewer: jenkins-bot
___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits