Writing extensions

List of variables to define extensions
Possible values for $type are:


 * — extensions that add special pages
 * — extensions that modify, add or replace functionality in the MediaWiki parser
 * — (added in 1.6.0)
 * — media handlers (added in 1.11)

Specifications for special pages
Introducing a new class as defined in an extension:

$wgSpecialPages stores a list of custom special pages:

$wgSpecialPageGroups defines the group membership of a special page:

Possible values for $type are:


 * — Maintenance reports
 * — Login / sign up
 * — Recent changes and logs
 * — Media reports and uploads
 * — Users and rights
 * — High use pages
 * — Lists of pages
 * — Redirecting special pages
 * — Page tools
 * — Wiki data and tools
 * — Other special pages

Hooks
Add a hook by doing:

or:

or:

or:

In the last case, the callback is expected to be a method in $object of the same name as the event preceded by “on”, e.g. “onUnknownAction”.

A special event name is used for parser function extensions:



For more details see Hooks manual.

Extension functions
$wgExtensionFunctions is an array of names of functions without parameters for the setup of extensions.

Parser extensions (tags)
New tags can be defined in the extension setup:

For more details see Tag extensions manual.