Manual:$wgHooks/ja

Category:MediaWiki configuration settings/ja#HooksCategory:MediaWiki configuration settings introduced in version 1.4.0/ja#HooksCategory:MediaWiki configuration settings still in use/ja#HooksCategory:Extension variables/ja#Hooks
拡張機能: $wgHooks
フックのグローバル リスト。
導入されたバージョン:1.4.0 (r6405)
除去されたバージョン:使用中
許容される値:詳細を参照
既定値:[]

詳細

フックのグローバル リストです。 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). 代わりに HookContainer::register および HookContainer::scopedRegister を使用してください。

以下の様にすることでフックを追加します。

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

または:

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

または:

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

または:

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


関連項目

Category:Extension variables/ja Category:MediaWiki configuration settings/ja Category:MediaWiki configuration settings introduced in version 1.4.0/ja Category:MediaWiki configuration settings still in use/ja