Template:Article for deletion/switch
| This template should not be substituted – use {{Article for deletion/switch}}. |
This is a small helper template used internally by {{AfD/dated}} (and related deletion-process templates) to pick one of four pieces of text depending on the action being sought in the nomination: merging, redirecting, draftifying, or (by default) deletion. It is not meant to be used on its own outside of these templates.
Usage
{{Article for deletion/switch|VALUE|merge-text|redirect-text|draftify-text|default-text}}
The template takes five unnamed (positional) parameters:
- The value to test, normally
|outcome=passed through from{{Afd}}. - The text to return if parameter 1 is
mergeormerging. - The text to return if parameter 1 is
redirectorredirecting. - The text to return if parameter 1 is
draft,draftify,draftifying, ordraftification. - The default text, returned for any other value, including a blank value,
delete, ordeletion. Most often used for deletion.
In other words, the template is a thin wrapper around a #switch parser function, matching parameter 1 against a small set of recognised outcome keywords and falling through to the default text (parameter 5) when nothing matches. This is what lets {{Afd}} show wording appropriate to the process actually being requested, without repeating four near-identical passages of prose throughout its code.
Example
Inside {{Afd}}, the switch is called several times, for example to choose the icon shown in the message box:
{{Article for deletion/switch|{{{outcome|}}}|[[File:Merge-arrow.svg|alt=|link=]]|none|none|none}}
Here, if |outcome= is set to merge, the merge-arrow icon is shown; for redirect, draftify, or any unrecognised/blank value (i.e., a normal deletion nomination), no icon (none) is shown instead.
It is also used to build the sentence describing what the discussion will decide, with a separate call supplying the "merging", "redirecting", "draftification", and "deletion" wording used throughout the notice.
TemplateData
TemplateData for Article for deletion
A helper template used by Template:Afd to choose wording appropriate to the requested outcome of a deletion discussion (merge, redirect, draftify, or delete). Not intended for standalone use.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Value to test | 1 | The outcome value being checked, usually {{{outcome|}}} passed through from Template:Afd. Recognised values are merge, merging, redirect, redirecting, draft, draftify, draftifying, and draftification; anything else (including blank) falls through to the default. | String | required |
| Merge text | 2 | Text returned when parameter 1 is "merge" or "merging". | Content | required |
| Redirect text | 3 | Text returned when parameter 1 is "redirect" or "redirecting". | Content | required |
| Draftify text | 4 | Text returned when parameter 1 is "draft", "draftify", "draftifying", or "draftification". | Content | required |
| Default (deletion) text | 5 | Text returned for any value not matched above, including a blank value, "delete", or "deletion". This is effectively the deletion case. | Content | required |
See also
- {{AfD/dated}}