/** * Add ResourceLoader module styles for OOUI and set up the PHP implementation of it for use with * MediaWiki and this OutputPage instance. * * @since 1.25 */ public function enableOOUI() { OOUI\Theme::setSingleton(new OOUI\MediaWikiTheme()); OOUI\Element::setDefaultDir($this->getLanguage()->getDir()); $this->addModuleStyles(array('oojs-ui.styles', 'oojs-ui.styles.icons', 'oojs-ui.styles.indicators', 'oojs-ui.styles.textures')); }
/** * Helper function to setup the PHP implementation of OOUI to use in this request. * * @since 1.26 * @param String $skinName The Skin name to determine the correct OOUI theme * @param String $dir Language direction */ public static function setupOOUI($skinName = '', $dir = 'ltr') { $themes = ExtensionRegistry::getInstance()->getAttribute('SkinOOUIThemes'); // Make keys (skin names) lowercase for case-insensitive matching. $themes = array_change_key_case($themes, CASE_LOWER); $theme = isset($themes[$skinName]) ? $themes[$skinName] : 'MediaWiki'; // For example, 'OOUI\MediaWikiTheme'. $themeClass = "OOUI\\{$theme}Theme"; OOUI\Theme::setSingleton(new $themeClass()); OOUI\Element::setDefaultDir($dir); }
$autoload = '../vendor/autoload.php'; if (!file_exists($autoload)) { echo '<h1>Did you forget to run <code>composer install</code>?</h1>'; exit; } require_once $autoload; $theme = isset($_GET['theme']) && $_GET['theme'] === 'apex' ? 'apex' : 'mediawiki'; $themeClass = 'OOUI\\' . ($theme === 'apex' ? 'Apex' : 'MediaWiki') . 'Theme'; OOUI\Theme::setSingleton(new $themeClass()); $graphicSuffixMap = array('mixed' => '', 'vector' => '.vector', 'raster' => '.raster'); $graphic = isset($_GET['graphic']) && isset($graphicSuffixMap[$_GET['graphic']]) ? $_GET['graphic'] : 'vector'; $graphicSuffix = $graphicSuffixMap[$graphic]; $direction = isset($_GET['direction']) && $_GET['direction'] === 'rtl' ? 'rtl' : 'ltr'; $directionSuffix = $direction === 'rtl' ? '.rtl' : ''; OOUI\Element::setDefaultDir($direction); $query = array('theme' => $theme, 'graphic' => $graphic, 'direction' => $direction); $styleFileName = "oojs-ui-{$theme}{$graphicSuffix}{$directionSuffix}.css"; ?> <!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="UTF-8"> <title>OOjs UI Widget Demo</title> <link rel="stylesheet" href="../dist/<?php echo $styleFileName; ?> " title="theme"> <link rel="stylesheet" href="styles/demo<?php echo $directionSuffix; ?>
/** * Add ResourceLoader module styles for OOUI and set up the PHP implementation of it for use with * MediaWiki and this OutputPage instance. * * @since 1.25 */ public function enableOOUI() { $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', 'oojs-ui.styles.icons', 'oojs-ui.styles.indicators', 'oojs-ui.styles.textures', 'mediawiki.widgets.styles')); }
/** * Add ResourceLoader module styles for OOUI and set up the PHP implementation of it for use with * MediaWiki and this OutputPage instance. * * @since 1.25 */ public function enableOOUI() { OOUI\Theme::setSingleton(new OOUI\MediaWikiTheme()); OOUI\Element::setDefaultDir($this->getLanguage()->getDir()); $this->addModuleStyles('oojs-ui.styles'); }