Page MenuHomePhabricator

show on select does not expand templates
Open, Needs TriagePublic


Dear all,

I am using the following field definition (let's not bother about the line breaks). I need this construct for translating dropdown values. The mapping template stores {{int:}} tags.

{{{field|status|input type=dropdown
 |values={{Dropdown definition project}}
 |mapping template=mapping dropdown definition project
 |show on select={{Mapping dropdown definition project|status-1}}=>id1;{{Mapping dropdown definition project|status-2}}=>id2

Problem: The templates in the show on select parameter do not get expanded and are passed over to the JS as plain strings. As a result the dropdown values do not match with the show on select identifiers anymore.

Proposed solution (tested in my case only)

diff --git a/includes/PF_FormField.php b/includes/PF_FormField.php
index c051e3fe..0b7bdfc4 100644
--- a/includes/PF_FormField.php
+++ b/includes/PF_FormField.php
@@ -251,7 +251,7 @@ class PFFormField {
 						$option_div_pair = explode( '=>', $val, 2 );
 						if ( count( $option_div_pair ) > 1 ) {
-							$option = $option_div_pair[0];
+							$option = trim($wgParser->recursiveTagParse($option_div_pair[0]));
 							$div_id = $option_div_pair[1];
 							if ( array_key_exists( $div_id, $show_on_select ) ) {
 								$show_on_select[$div_id][] = $option;

Happy for feedback + and I am willing to do further testing, etc if needed.

Event Timeline

Schtom created this task.Mar 5 2019, 9:38 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 5 2019, 9:38 AM

Thanks for taking a look at the code!
Is this about MediaWiki-extensions-Page_Forms, or which codebase does this refer to?
Please feel free to add a project via the Add Action...Change Project Tags dropdown so a developer/maintainer could find this task.

You are very welcome to use developer access to submit the proposed code changes as a Git branch directly into Gerrit which makes it easier to review them quickly and provide feedback. If you don't want to set up Git/Gerrit, you can also use the Gerrit Patch Uploader. Thanks again!

Are there any updates on this issue?

Restricted Application added a subscriber: Liuxinyu970226. · View Herald TranscriptMar 25 2019, 11:10 AM