MediaWiki REL1_41
|
Static Public Member Functions | |
static | clear ( $name) |
Clears hooks registered via Hooks::register(). | |
static | getHandlers ( $name) |
Returns an array of all the event functions attached to a hook This combines functions registered via Hooks::register and with $wgHooks. | |
static | isRegistered ( $name) |
Returns true if a hook has a function registered to it. | |
static | register ( $name, $handler) |
Attach an event handler to a given hook in both legacy and non-legacy hook systems. | |
static | run ( $event, array $args=[], $deprecatedVersion=null) |
Call hook functions defined in Hooks::register and $wgHooks. | |
static | runner () |
Get a HookRunner instance for calling hooks using the new interfaces. | |
static | runWithoutAbort ( $event, array $args=[], $deprecatedVersion=null) |
Call hook functions defined in Hooks::register and $wgHooks. | |
|
static |
Clears hooks registered via Hooks::register().
Does not touch $wgHooks. This is intended for use while testing and will fail if MW_PHPUNIT_TEST is not defined.
string | $name | The name of the hook to clear. |
Definition at line 67 of file Hooks.php.
References wfDeprecated().
|
static |
Returns an array of all the event functions attached to a hook This combines functions registered via Hooks::register and with $wgHooks.
string | $name | Name of the hook |
Definition at line 100 of file Hooks.php.
References wfDeprecated().
|
static |
Returns true if a hook has a function registered to it.
The function may have been registered either via Hooks::register or in $wgHooks.
string | $name | Name of hook |
Definition at line 85 of file Hooks.php.
References wfDeprecated().
|
static |
Attach an event handler to a given hook in both legacy and non-legacy hook systems.
string | $name | Name of hook |
mixed | $handler | Hooks handler to attay |
Definition at line 50 of file Hooks.php.
References wfDeprecated().
|
static |
Call hook functions defined in Hooks::register and $wgHooks.
For the given hook event, fetch the array of hook events and process them. Determine the proper callback for each hook and then call the actual hook using the appropriate arguments. Finally, process the return value and return/throw accordingly.
For hook event that are not abortable through a handler's return value, use runWithoutAbort() instead.
string | $event | Event name |
array | $args | Array of parameters passed to hook functions |
string | null | $deprecatedVersion | [optional] Mark hook as deprecated with version number |
Exception |
Definition at line 128 of file Hooks.php.
References wfDeprecated().
|
static |
Get a HookRunner instance for calling hooks using the new interfaces.
Classes using dependency injection should instead receive a HookContainer and construct a private HookRunner from it.
Classes without dependency injection may alternatively use ProtectedHookAccessorTrait, a trait which provides getHookRunner() as a protected method.
Definition at line 170 of file Hooks.php.
References wfDeprecated().
|
static |
Call hook functions defined in Hooks::register and $wgHooks.
string | $event | Event name |
array | $args | Array of parameters passed to hook functions |
string | null | $deprecatedVersion | [optional] Mark hook as deprecated with version number |
UnexpectedValueException | callback returns an invalid value |
Definition at line 146 of file Hooks.php.
References wfDeprecated().