Manual:$wgHooks
Extensiones: $wgHooks | |
---|---|
Global list of hooks. |
|
Introducido en la versión: | 1.4.0 (r6405) |
Eliminado en la versión: | aún se usa |
Valores permitidos: | Ver detalles |
Valor predeterminado: | [] |
Otras configuraciones: Alfabéticamente | Por Función |
Detalles
Global list of hooks. It is an array of arrays: it specifies for every event an array of functions to be called.
In MW 1.40, the use of $wgHooks after initialisation was deprecated (T331602). Use HookContainer::register y HookContainer::scopedRegister instead.
Add a hook by doing:
$wgHooks['event_name'][] = 'function';
o:
$wgHooks['event_name'][] = array( 'function', $data );
o:
$wgHooks['event_name'][] = array( $object, 'method' );
o:
$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.