Manual:Hooks/SpecialVersionExtensionTypes

SpecialVersionExtensionTypes
Available from version 1.6.0
Removed in version 1.24.0
Adds to the types that can be used with $wgExtensionCredits
Define function:
public static function onSpecialVersionExtensionTypes( &$oSpecialVersion, &$aExtensionTypes ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"SpecialVersionExtensionTypes": "MediaWiki\\Extension\\MyExtension\\Hooks::onSpecialVersionExtensionTypes"
	}
}
Called from: File(s): SpecialVersion.php
Interface: SpecialVersionExtensionTypesHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:SpecialVersionExtensionTypes extensions.


Use cases

edit

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

edit

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

edit

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.