Manual:Hooks/SpecialVersionExtensionTypes
File:OOjs UI icon alert-destructive.svg | <translate> This feature was removed completely in version <tvar name=ver>1.24.0</tvar> (after being deprecated in <tvar name=4>1.17.0</tvar>).</translate> |
SpecialVersionExtensionTypes | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate> <translate> Removed in <tvar name=1><translate> version <tvar </tvar></translate> Adds to the types that can be used with $wgExtensionCredits | |
<translate> Define function:</translate> | public static function onSpecialVersionExtensionTypes( &$oSpecialVersion, &$aExtensionTypes ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"SpecialVersionExtensionTypes": "MediaWiki\\Extension\\MyExtension\\Hooks::onSpecialVersionExtensionTypes"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> SpecialVersion.php |
<translate> Interface:</translate> | SpecialVersionExtensionTypesHook.php |
<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:SpecialVersionExtensionTypes extensions</tvar>.</translate>
Use cases
MediaWiki installations use the SpecialVersionExtensionTypes
hook to achieve more fine grained control over the list of extension types displayed on the Special:Version page. With this hook they can
- change the labels used to identify each extension type
- change the way extensions are split into groups by type
Background
The Special:Version page lists the current version of MediaWiki and all extensions installed. The listing categories the extensions based on the type provided to $wgExtensionCredits .
By default, extensions are grouped into five categories: specialpage, parserhook, variable, media, and other. This hook can be used to add or remove types and/or change the label associated with each type.
Usage
Functions attached to this hook add and remove extension types to $aExtensionTypes
. The array is keyed by typeid and its values are the display labels associated with each type. typeid is a locale-independent type id used as the value for the 'type' element of $wgExtensionCredits .
Functions attached to this hook should return true
so that other functions attached to this hook may run.