Add OutputPage::enableOOUI() to set up OOUI stuff when needed
authorBartosz Dziewoński <matma.rex@gmail.com>
Mon, 5 Jan 2015 20:18:57 +0000 (21:18 +0100)
committerBartosz Dziewoński <matma.rex@gmail.com>
Fri, 16 Jan 2015 23:10:57 +0000 (15:10 -0800)
Initialize OOUI theme and set OOUI element directionality, load
necessary RL modules.

Bug: T85767
Change-Id: I9aa430969e4250bd2bd6c396b6133a35ca5bf46b

includes/OutputPage.php

index a10946a..413c75f 100644 (file)
@@ -3878,4 +3878,16 @@ class OutputPage extends ContextSource {
        public function sectionEditLinksEnabled() {
                return $this->mEnableSectionEditLinks;
        }
+
+       /**
+        * 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' );
+       }
 }