From: Bartosz DziewoƄski Date: Thu, 23 Jul 2015 16:37:53 +0000 (+0200) Subject: OutputPage: Load skin-appropriate OOUI theme X-Git-Tag: 1.31.0-rc.0~10669^2 X-Git-Url: http://git.cyclocoop.org/data/Fool?a=commitdiff_plain;h=94b10f0b2cb86025e7c2c8f5e13b79d4ee96369e;p=lhc%2Fweb%2Fwiklou.git OutputPage: Load skin-appropriate OOUI theme We allow skins to choose the appropriate OOUI theme for it using 'SkinOOUIThemes', but we ignored that here. Luckily this was not a problem for the Apex theme (the only one other than the default, MediaWiki theme), the additional CSS classes this generated were just ignored. Depends on Apex and MonoBook skins being updated to use canonical case for theme names, see I1a88092f0ceb210c642bbee875e368ded3c186f8. Change-Id: I368804cca141acf9cc15a348d9b7244046395a70 --- diff --git a/includes/OutputPage.php b/includes/OutputPage.php index e832b82b42..22c6890944 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -3952,7 +3952,14 @@ class OutputPage extends ContextSource { * @since 1.25 */ public function enableOOUI() { - OOUI\Theme::setSingleton( new OOUI\MediaWikiTheme() ); + $themes = ExtensionRegistry::getInstance()->getAttribute( 'SkinOOUIThemes' ); + // Make keys (skin names) lowercase for case-insensitive matching. + $themes = array_change_key_case( $themes, CASE_LOWER ); + $skinName = strtolower( $this->getSkin()->getSkinName() ); + $theme = isset( $themes[ $skinName ] ) ? $themes[ $skinName ] : 'MediaWiki'; + // For example, 'OOUI\MediaWikiTheme'. + $themeClass = "OOUI\\{$theme}Theme"; + OOUI\Theme::setSingleton( new $themeClass() ); OOUI\Element::setDefaultDir( $this->getLanguage()->getDir() ); $this->addModuleStyles( array( 'oojs-ui.styles',