r49764 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r49763‎ | r49764 | r49765 >
Date:09:27, 23 April 2009
Author:werdna
Status:deferred
Tags:
Comment:
Add importData() method, for a clear way to import form data programmatically.
Modified paths:
  • /branches/preferences-work/phase3/includes/HTMLForm.php (modified) (history)

Diff [purge]

Index: branches/preferences-work/phase3/includes/HTMLForm.php
@@ -312,6 +312,16 @@
313313 $this->mFieldData = $fieldData;
314314 }
315315
 316+ function importData( $fieldData ) {
 317+ // Filter data.
 318+ foreach( $fieldData as $name => &$value ) {
 319+ $field = $this->mFlatFields[$name];
 320+ $value = $field->filter( $value, $this->mFlatFields );
 321+ }
 322+
 323+ $this->mFieldData = $fieldData;
 324+ }
 325+
316326 function suppressReset( $suppressReset = true ) {
317327 $this->mShowReset = !$suppressReset;
318328 }

Status & tagging log