Last modified: 2014-02-12 23:38:20 UTC
Found an unreported snazzy enhancement posted last week, complete with patch: http://www.mediawiki.org/wiki/Extension_talk:Semantic_Forms#values.3D.7B.7B.23arrayprint:MyResults.7D.7D Copied below: It would be great to have parsing attached to values=. Obviously there are limitations, as there are with the parsing related to default=. In particular, I've got properties on several pages, and I want to create a checkbox input that lists the various properties. For that case, I'd do something like {{#arraydefine:CoAnchors| {{#ask: [[Category:Event Description]] [[Has CoAnchor::~*]] |?Has CoAnchor= |link=none |mainlabel=- }} }} {{#arrayunique:CoAnchors}} {{#arraysort:CoAnchors|asc}} Select Your Top 3 Co-Anchors:<br> {{{field|CoAnchor List|values={{#arrayprint:CoAnchors}}|input type=checkboxes}}} For those of you who don't want to wait for something more official, the change is easy enough: Index: ~/extensions/SemanticForms/includes/SF_FormPrinter.php =================================================================== --- ~/extensions/SemanticForms/includes/SF_FormPrinter.php (revision 218) +++ ~/extensions/SemanticForms/includes/SF_FormPrinter.php (revision 219) @@ -735,7 +735,8 @@ $field_args['remote autocompletion'] = true; } elseif ( $sub_components[0] == 'values' ) { // remove whitespaces, and un-escape characters - $possible_values = array_map( 'trim', explode( ',', $sub_components[1] ) ); + // Make values= use the parser so that arrays can be used + $possible_values = array_map( 'trim', explode( ',', $wgParser->recursiveTagParse( $sub_components[1] ) ) ); Keep in mind that my version may be different from yours with respect to line numbers and possibly the source itself. Incidentally, if there's already a better way to set values like this, please let me know. Thanks. --Skew 07:27, 20 August 2011 (UTC)
For SF 2.4.2 (plus?), the replacement is simply } elseif ( $sub_components[0] == 'values' ) { // also been set - $values = $sub_components[1]; + $values = trim( $wgParser->recursiveTagParse( $sub_components[1] ) ); The delimiter is taken care of properly after component parsing. Sal (and sometimes Skew)