From 94b10f0b2cb86025e7c2c8f5e13b79d4ee96369e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Thu, 23 Jul 2015 18:37:53 +0200 Subject: [PATCH] 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 --- includes/OutputPage.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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', -- 2.20.1