FileForm creates an interactive form that fills out a template when uploading a file. Inputted user values will be passed to template parameters, allowing wikis to create a well-managed file data system.
Installation
Configuration
Config is stored as JSON in MediaWiki:Gadget-FileForm/data.json.
The name of the template is stored in the template key. (default is File)
The elements of the form are stored as an array in the form key. (required) Possible properties are:
| Key | Value | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
id
|
string | The template parameter | ||||||||||
type
|
|
The type of input to show | ||||||||||
options
|
object | Options/suggestions to use (if the type is select or datalist)
The key will be used as the parameter value and the value will be used as the user display text. | ||||||||||
default
|
string | Initial value to use in the form. If the user's value is the same as the default value, the parameter will be omitted from the template. | ||||||||||
if
|
object | Each key in the object should be an id and each value is an array of values to check against. If one of the values of each of the keys provided matches the current value of the key, the element will be shown.
|
Example
{
"template": "FileForm",
"form": [
{
"id": "description",
"type": "textarea",
"label": "Description:"
},
{
"id": "type",
"type": "select",
"label": "Type:",
"options": {
"screenshot": "Screenshot",
"asset": "Game asset"
},
"default": "screenshot"
},
{
"id": "filename",
"type": "input",
"label": "Asset file name:",
"if": {
"type": ["asset"]
}
}
]
}
Text above can be found here (edit)