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
* @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',