Manual:$wgHooks/ko
Appearance
| Extensions: $wgHooks | |
|---|---|
| Global list of hooks. |
|
| 이 변수가 소개된 버전: | 1.4.0 (r6405) |
| 이 변수가 사라진 버전: | 계속해서 쓰이고 있음 |
| 허용값: | See details |
| 기본값: | [] |
| 기타 설정: 알파벳 순 | 기능별 순 | |
상세
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 그리고 HookContainer::scopedRegister instead.
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.