Merge "Begin exposing SiteConfiguration via site contexts"
[lhc/web/wiklou.git] / includes / context / DerivativeContext.php
index e96269d..1e3fbf2 100644 (file)
@@ -65,6 +65,11 @@ class DerivativeContext extends ContextSource {
         */
        private $skin;
 
+       /**
+        * @var SiteConfiguration
+        */
+       private $config;
+
        /**
         * Constructor
         * @param IContextSource $context Context to inherit from
@@ -73,6 +78,28 @@ class DerivativeContext extends ContextSource {
                $this->setContext( $context );
        }
 
+       /**
+        * Set the SiteConfiguration object
+        *
+        * @param SiteConfiguration $c
+        */
+       public function setConfig( SiteConfiguration $s ) {
+               $this->config = $s;
+       }
+
+       /**
+        * Get the SiteConfiguration object
+        *
+        * @return SiteConfiguration
+        */
+       public function getConfig() {
+               if ( !is_null( $this->config ) ) {
+                       return $this->config;
+               } else {
+                       return $this->getContext()->getConfig();
+               }
+       }
+
        /**
         * Set the WebRequest object
         *