Page MenuHomePhabricator

Support for conditional parameters in TemplateData
Closed, InvalidPublic

Description

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

{{Webarchiv | url=http://de.wikipedia.org | wayback=20020921204942}}
{{Webarchiv | url=http://en.wikipedia.org | webciteID=1218580588013234}}
{{Webarchiv | url=http://de.wikipedia.org | 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=http://de.wikipedia.org | 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

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 moved this task from To Triage to Freezer on the VisualEditor board.
matmarex subscribed.

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.

After the changes from T101075, the other parameters will not be added any more (because empty parameters are not added). I think this task can be closed, and you can mark all of these parameters as "suggested" in that template's TemplateData again.

We have T52407 as a more general requests for defining dependencies/relationships between parameters.