Last modified: 2014-02-12 23:38:20 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T32652, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 30652 - Parsing templates etc in values=
Parsing templates etc in values=
Status: NEW
Product: MediaWiki extensions
Classification: Unclassified
SemanticForms (Other open bugs)
unspecified
All All
: Unprioritized enhancement (vote)
: ---
Assigned To: Yaron Koren
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-08-31 08:03 UTC by badon
Modified: 2014-02-12 23:38 UTC (History)
1 user (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description badon 2011-08-31 08:03: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)
Comment 1 Sal Quintanilla 2012-06-08 22:35:29 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)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links