Commit 742a57c3 authored by Tobias Haider's avatar Tobias Haider
Browse files

replace deprecated setupSkinUserCss with BeforePageDisplay hook, fixes #170

parent e8a07ec1
......@@ -51,6 +51,27 @@ class TweekiHooks {
return true;
}
/**
* Adding modules
*/
public static function onBeforePageDisplay( OutputPage $out, Skin $skin ) {
$styles = $GLOBALS['wgTweekiSkinStyles'];
if( $GLOBALS['wgTweekiSkinUseAwesome'] === true ) {
$styles[] = 'skins.tweeki.awesome.styles';
}
if( $GLOBALS['wgTweekiSkinUseBootstrapTheme'] === true ) {
$styles[] = 'skins.tweeki.bootstraptheme.styles';
}
if( isset( $GLOBALS['wgCookieWarningEnabled'] ) && $GLOBALS['wgCookieWarningEnabled'] === true ) {
$styles[] = 'skins.tweeki.cookiewarning.styles';
}
foreach( $GLOBALS['wgTweekiSkinCustomCSS'] as $customstyle ) {
$styles[] = $customstyle;
}
Hooks::run( 'SkinTweekiStyleModules', array( $this, &$styles ) );
$out->addModuleStyles( $styles );
}
/**
* Manipulate headlines – we need .mw-headline to be empty because it has a padding
* that we need for correct positioning for anchors and this would render links above headlines inaccessible
......
......@@ -63,30 +63,6 @@ class SkinTweeki extends SkinTemplate {
Hooks::run( 'SkinTweekiAdditionalBodyClasses', array( $this, &$GLOBALS['wgTweekiSkinAdditionalBodyClasses'] ) );
static::$bodyClasses = array_merge( static::$bodyClasses, $GLOBALS['wgTweekiSkinAdditionalBodyClasses'] );
}
/**
* Loads skin and user CSS files.
* @param OutputPage $out
*/
function setupSkinUserCss( OutputPage $out ) {
parent::setupSkinUserCss( $out );
$styles = $GLOBALS['wgTweekiSkinStyles'];
if( $GLOBALS['wgTweekiSkinUseAwesome'] === true ) {
$styles[] = 'skins.tweeki.awesome.styles';
}
if( $GLOBALS['wgTweekiSkinUseBootstrapTheme'] === true ) {
$styles[] = 'skins.tweeki.bootstraptheme.styles';
}
if( isset( $GLOBALS['wgCookieWarningEnabled'] ) && $GLOBALS['wgCookieWarningEnabled'] === true ) {
$styles[] = 'skins.tweeki.cookiewarning.styles';
}
foreach( $GLOBALS['wgTweekiSkinCustomCSS'] as $customstyle ) {
$styles[] = $customstyle;
}
Hooks::run( 'SkinTweekiStyleModules', array( $this, &$styles ) );
$out->addModuleStyles( $styles );
}
/**
* Override to pass our Config instance to it
......
......@@ -38,7 +38,8 @@
"MagicWordMagicWords": "TweekiHooks::onMagicWordMagicWords",
"MagicWordwgVariableIDs": "TweekiHooks::onMagicWordwgVariableIDs",
"InternalParseBeforeLinks": "TweekiHooks::onInternalParseBeforeLinks",
"OutputPageBeforeHTML": "TweekiHooks::onOutputPageBeforeHTML"
"OutputPageBeforeHTML": "TweekiHooks::onOutputPageBeforeHTML",
"BeforePageDisplay": "TweekiHooks::onBeforePageDisplay"
},
"ResourceModules": {
"skins.tweeki.bootstrap.styles": {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment