https://bugzilla.wikimedia.org/show_bug.cgi?id=30652
Web browser: ---
Bug #: 30652
Summary: Parsing templates etc in values=
Product: MediaWiki extensions
Version: any
Platform: All
OS/Version: All
Status: NEW
Severity: enhancement
Priority: Unprioritized
Component: SemanticForms
AssignedTo: [email protected]
ReportedBy: [email protected]
CC: [email protected]
Classification: Unclassified
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)
--
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l