Open main menu

Podręcznik:$wgHooks

This page is a translated version of the page Manual:$wgHooks and the translation is 58% complete.
Other languages:
Deutsch • ‎English • ‎Türkçe • ‎español • ‎français • ‎magyar • ‎polski • ‎português do Brasil • ‎čeština • ‎中文 • ‎日本語
Rozszerzenia: $wgHooks
Global list of hooks.
Wprowadzono w wersji:1.4.0 (r6405)
Usunięto w wersji:nadal w użyciu
Dozwolone wartości:Zobacz szczegóły
Domyślna wartość:[]

Szczegóły

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';

lub:

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

lub:

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

lub:

$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.

Zobacz też