Page MenuHomePhabricator

Support for conditional parameters in TemplateData
Open, LowPublic


On the German-language Wikipedia, we have Vorlage:Webarchiv, which supports three different web archives, e.g.

{{Webarchiv | url= | wayback=20020921204942}}
{{Webarchiv | url= | webciteID=1218580588013234}}
{{Webarchiv | url= | archive-is=20020921204942}}

Since all three archive-ID fields have to be tagged as required in order to be visible to a user inserting such a template, the VisualEditor adds two empty named parameters, even though logically, only one archive-ID can be non-empty:

{{Webarchiv | url= | wayback=20020921204942 | webciteID= | archive-is= }}

A similar problem was raised today here, where a template has two different spellings of the parameter ''Größe''/''Grösse'' to be used for German/Austrian and Swiss articles, respectively.

In both these cases, it would be useful if there was a way in TemplateData to specify that only one of these parameters can be set, resulting in the other parameters not being added.

Another usecase was already suggested in a comment to a different task:

Based on a discussion on frwp, it appears that some fields should be conditionally displayed TemplateData.
For example, on an infobox, if there is no image, you don't need to suggest fields like "image caption" or "image size" on TemplateData.
Is it possible to have conditional displaying like that, @Jdforrester-WMF?

Event Timeline

Cirdan created this task.Apr 17 2018, 5:39 PM
Restricted Application added a project: VisualEditor. · View Herald TranscriptApr 17 2018, 5:39 PM
Restricted Application added a subscriber: Aklapper. · View Herald Transcript

I think this is related to T52407, about the larger need of a way to specify dependencies between parameters. There is indeed a lot of work still to be done in order to make sure that TemplateStyles can deal with any kind of templates. However, I doubt that “low priority” will ever get us there …

I believe that this task is a sub-task of T52407, as it is mainly concerned with not adding extra parameters to the wikitext. This is different from full-fledged dependency management.

Deskana triaged this task as Low priority.Jun 19 2018, 6:48 PM
Deskana moved this task from To Triage to Freezer on the VisualEditor board.