Demon has submitted this change and it was merged.

Change subject: Allow adding arbitrary properties to OutputPage
......................................................................


Allow adding arbitrary properties to OutputPage

Helps to pass extension-specific data

Change-Id: Iea98510abc100128733361f2d2287802f35bb359
---
M includes/OutputPage.php
1 file changed, 31 insertions(+), 0 deletions(-)

Approvals:
  Demon: Looks good to me, approved
  awjrichards: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/includes/OutputPage.php b/includes/OutputPage.php
index 89d7c0b..b0ee815 100644
--- a/includes/OutputPage.php
+++ b/includes/OutputPage.php
@@ -249,6 +249,11 @@
        private $mRedirectedFrom = null;
 
        /**
+        * Additional key => value data
+        */
+       private $mProperties = array();
+
+       /**
         * Constructor for OutputPage. This should not be called directly.
         * Instead a new RequestContext should be created and it will 
implicitly create
         * a OutputPage tied to that context.
@@ -621,6 +626,32 @@
        }
 
        /**
+        * Set an additional output property
+        * @since 1.21
+        *
+        * @param string $name
+        * @param mixed $value
+        */
+       public function setProperty( $name, $value ) {
+               $this->mProperties[$name] = $value;
+       }
+
+       /**
+        * Get an additional output property
+        * @since 1.21
+        *
+        * @param $name
+        * @return mixed: Property value or null if not found
+        */
+       public function getProperty( $name ) {
+               if ( isset( $this->mProperties[$name] ) ) {
+                       return $this->mProperties[$name];
+               } else {
+                       return null;
+               }
+       }
+
+       /**
         * checkLastModified tells the client to use the client-cached page if
         * possible. If successful, the OutputPage is disabled so that
         * any future call to OutputPage->output() have no effect.

-- 
To view, visit https://gerrit.wikimedia.org/r/48208
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Iea98510abc100128733361f2d2287802f35bb359
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: MaxSem <maxsem.w...@gmail.com>
Gerrit-Reviewer: Anomie <bjor...@wikimedia.org>
Gerrit-Reviewer: Demon <ch...@wikimedia.org>
Gerrit-Reviewer: MaxSem <maxsem.w...@gmail.com>
Gerrit-Reviewer: Reedy <re...@wikimedia.org>
Gerrit-Reviewer: awjrichards <aricha...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to