http://www.mediawiki.org/wiki/Special:Code/MediaWiki/97279
Revision: 97279 Author: yaron Date: 2011-09-16 14:46:54 +0000 (Fri, 16 Sep 2011) Log Message: ----------- Added ability to directly pass in form fields to create() function, for use by Page Schemas extension Modified Paths: -------------- trunk/extensions/SemanticForms/includes/SF_TemplateInForm.php Modified: trunk/extensions/SemanticForms/includes/SF_TemplateInForm.php =================================================================== --- trunk/extensions/SemanticForms/includes/SF_TemplateInForm.php 2011-09-16 14:45:56 UTC (rev 97278) +++ trunk/extensions/SemanticForms/includes/SF_TemplateInForm.php 2011-09-16 14:46:54 UTC (rev 97279) @@ -130,14 +130,18 @@ return $templateFields; } - static function create( $name, $label = null, $allowMultiple = null, $maxAllowed = null ) { + static function create( $name, $label = null, $allowMultiple = null, $maxAllowed = null, $formFields = null ) { $tif = new SFTemplateInForm(); $tif->mTemplateName = str_replace( '_', ' ', $name ); $tif->mFields = array(); - $fields = $tif->getAllFields(); - $field_num = 0; - foreach ( $fields as $field ) { - $tif->mFields[] = SFFormField::create( $field_num++, $field ); + if ( is_null( $formFields ) ) { + $fields = $tif->getAllFields(); + $field_num = 0; + foreach ( $fields as $field ) { + $tif->mFields[] = SFFormField::create( $field_num++, $field ); + } + } else { + $tif->mFields = $formFields; } $tif->mLabel = $label; $tif->mAllowMultiple = $allowMultiple; _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs