Jump to content

Manual:Interface/Gadgets-definition

From mediawiki.org

MediaWiki:Gadgets-definition is the page which defines the gadgets available to users at Gadgets, a tab in Special:Preferences provided by Extension:Gadgets . For details, see Extension:Gadgets .

Format

Each line on the MediaWiki:Gadgets-definition page should start with a "*" (asterisk) character to define a gadget. The line takes the following format:

* mygadget [options] | page names

The first field ("mygadget" in the example) is the gadget's internal name. The label for the preferences page comes from an interface message page (MediaWiki:Gadget-mygadget) where the proper name and a short description can be written, which also allows wikitext markup to be used.

The internal name must begin with a basic Latin letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens (-), underscores (_), and periods (.). The reason for this limitation is that the internal name must be valid as the name of an HTML form name, as MediaWiki interface message key, and as ResourceLoader module name.

Options format:

[ResourceLoader | option1 | option2 | ... optionN]

The ResourceLoader flag is required unless the gadget contains only styles. Options that are "flags" only need to have their name written to be turned on. Options that need a value are followed by an equals sign and a comma-separated list of values. All whitespace is optional and may be omitted.

[ResourceLoader | myflag | mykey = value1, value2, value3 ]

Examples:

* mygadget[ResourceLoader]|mygadget.js|mygadget.css

or

* mygadget[ResourceLoader|package]| mygadget.js | mygadget-Foo.js | mygadget-data.json | mygadget.css

or

* mygadget[ ResourceLoader | rights=foo, bar ] | mygadget.js | mygadget.css


Sections

Gadgets-definition can contain sections, but no distinction is made between different levels of headings. Headings are not used directly for display, but instead refer to a MediaWiki message for that section heading beginning with MediaWiki:Gadget-section-. So ==LanguageSupport== refers to MediaWiki:Gadget-section-LanguageSupport, and the content of that message (or of the localized subpages, MediaWiki:Gadget-section-LanguageSupport/de etc.) will be displayed to the user at Special:Preferences.