r95979 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r95978‎ | r95979 | r95980 >
Date:13:18, 1 September 2011
Author:catrope
Status:ok
Tags:
Comment:
RL2: Factor the building of the metadata array in Gadget::getJSON() out to Gadget::getMetadata()
Modified paths:
  • /branches/RL2/extensions/Gadgets/backend/Gadget.php (modified) (history)

Diff [purge]

Index: branches/RL2/extensions/Gadgets/backend/Gadget.php
@@ -78,11 +78,19 @@
7979 }
8080
8181 /**
 82+ * Retrieve the metadata of this gadget, in the same format as $properties in __construct()
 83+ * @return array
 84+ */
 85+ public function getMetadata() {
 86+ return array( 'settings' => $this->settings, 'module' => $this->moduleData );
 87+ }
 88+
 89+ /**
8290 * Retrieve the JSON representation of this gadget, in the same format as $properties in __construct().
8391 * @return string JSON
8492 */
8593 public function getJSON() {
86 - return FormatJson::encode( array( 'settings' => $this->settings, 'module' => $this->moduleData ) );
 94+ return FormatJson::encode( $this->getMetadata() );
8795 }
8896
8997 /**

Follow-up revisions

RevisionCommit summaryAuthorDate
r95980RL2: Expose the Gadget metadata natively, rather than JSON wrapped in another...catrope13:20, 1 September 2011

Status & tagging log