Manual:$wgHooks

From MediaWiki.org
Jump to navigation Jump to search

Other languages:
Deutsch • ‎English • ‎Nederlands • ‎català • ‎dansk • ‎español • ‎français • ‎italiano • ‎polski • ‎português • ‎português do Brasil • ‎suomi • ‎العربية • ‎മലയാളം • ‎中文 • ‎日本語
Extensions: $wgHooks
Global list of hooks.
Introduced in version:1.4.0 (r6405)
Removed in version:still in use
Allowed values:See details
Default value:array()
Other settings: Alphabetical | By function

Details[edit]

Global list of hooks. It is an array of arrays: it specifies for every event an array of functions to be called.

Add a hook by doing:

$wgHooks['event_name'][] = 'function';

or:

$wgHooks['event_name'][] = array( 'function', $data );

or:

$wgHooks['event_name'][] = array( $object, 'method' );

or:

$wgHooks['event_name'][] = $object;

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"

Hooks are called when events happen, where a hook is a PHP function, and an event is an abstract concept.

See also[edit]