Elgg
Version 4.3
|
Base class for events and hooks. More...
Public Member Functions | |
registerHandler ($name, $type, $callback, $priority=500) | |
Register a callback as a plugin hook handler. More... | |
unregisterHandler ($name, $type, $callback) | |
Unregister a callback as a plugin hook of event handler. More... | |
clearHandlers ($name, $type) | |
Clears all callback registrations for a plugin hook. More... | |
getAllHandlers () | |
Returns all registered handlers as array( $name => array( $type => array( $priority => array( callback, callback, ) ) ) More... | |
hasHandler ($name, $type) | |
Is a handler registered for this specific name and type? "all" handlers are not considered. More... | |
getOrderedHandlers ($name, $type) | |
Returns an ordered array of handlers registered for $name and $type. More... | |
backup () | |
Temporarily remove all event/hook registrations (before tests) More... | |
restore () | |
Restore backed up event/hook registrations (after tests) More... | |
Public Attributes | |
const | REG_KEY_PRIORITY = 0 |
const | REG_KEY_INDEX = 1 |
const | REG_KEY_HANDLER = 2 |
const | OPTION_DEPRECATION_MESSAGE = 'deprecation_message' |
const | OPTION_DEPRECATION_VERSION = 'deprecation_version' |
Protected Member Functions | |
getMatcher ($spec) | |
Create a matcher for the given callable (if it's for a static or dynamic method) More... | |
checkDeprecation ($name, $type, array $options=[]) | |
Check if handlers are registered on a deprecated hook/event. More... | |
Base class for events and hooks.
Definition at line 14 of file HooksRegistrationService.php.
Elgg\HooksRegistrationService::backup | ( | ) |
Temporarily remove all event/hook registrations (before tests)
Call backup() before your tests and restore() after.
Definition at line 258 of file HooksRegistrationService.php.
|
protected |
Check if handlers are registered on a deprecated hook/event.
If so Display a message
string | $name | the name of the hook/event |
string | $type | the type of the hook/event |
array | $options | deprecation options |
Definition at line 285 of file HooksRegistrationService.php.
Elgg\HooksRegistrationService::clearHandlers | ( | $name, | |
$type | |||
) |
Clears all callback registrations for a plugin hook.
string | $name | The name of the hook |
string | $type | The type of the hook |
Definition at line 124 of file HooksRegistrationService.php.
Elgg\HooksRegistrationService::getAllHandlers | ( | ) |
Returns all registered handlers as array( $name => array( $type => array( $priority => array( callback, callback, ) ) )
Definition at line 141 of file HooksRegistrationService.php.
|
protected |
Create a matcher for the given callable (if it's for a static or dynamic method)
callable | $spec | Callable we're creating a matcher for |
Definition at line 227 of file HooksRegistrationService.php.
Elgg\HooksRegistrationService::getOrderedHandlers | ( | $name, | |
$type | |||
) |
Returns an ordered array of handlers registered for $name and $type.
string | $name | The name of the hook |
string | $type | The type of the hook |
Definition at line 178 of file HooksRegistrationService.php.
Elgg\HooksRegistrationService::hasHandler | ( | $name, | |
$type | |||
) |
Is a handler registered for this specific name and type? "all" handlers are not considered.
If you need to consider "all" handlers, you must check them independently, or use (bool) elgg()->hooks->getOrderedHandlers().
string | $name | The name of the hook |
string | $type | The type of the hook |
Definition at line 166 of file HooksRegistrationService.php.
Elgg\HooksRegistrationService::registerHandler | ( | $name, | |
$type, | |||
$callback, | |||
$priority = 500 |
|||
) |
Register a callback as a plugin hook handler.
string | $name | The name of the hook |
string | $type | The type of the hook |
callable | $callback | The name of a valid function or an array with object and method |
int | $priority | The priority - 500 is default, lower numbers called first |
Definition at line 54 of file HooksRegistrationService.php.
Elgg\HooksRegistrationService::restore | ( | ) |
Restore backed up event/hook registrations (after tests)
Definition at line 269 of file HooksRegistrationService.php.
Elgg\HooksRegistrationService::unregisterHandler | ( | $name, | |
$type, | |||
$callback | |||
) |
Unregister a callback as a plugin hook of event handler.
string | $name | The name of the hook/event |
string | $type | The name of the type of entity (eg "user", "object" etc) |
callable | $callback | The PHP callback to be removed. Since 1.11, static method callbacks will match dynamic methods |
Definition at line 89 of file HooksRegistrationService.php.
const Elgg\HooksRegistrationService::OPTION_DEPRECATION_MESSAGE = 'deprecation_message' |
Definition at line 22 of file HooksRegistrationService.php.
const Elgg\HooksRegistrationService::OPTION_DEPRECATION_VERSION = 'deprecation_version' |
Definition at line 23 of file HooksRegistrationService.php.
const Elgg\HooksRegistrationService::REG_KEY_HANDLER = 2 |
Definition at line 20 of file HooksRegistrationService.php.
const Elgg\HooksRegistrationService::REG_KEY_INDEX = 1 |
Definition at line 19 of file HooksRegistrationService.php.
const Elgg\HooksRegistrationService::REG_KEY_PRIORITY = 0 |
Definition at line 18 of file HooksRegistrationService.php.