|
| dispatch (object $event) |
| Provide all relevant listeners with an event to process.
|
|
| get_all_callbacks () |
| Returns list of all callbacks found in db/hooks.php files.
|
|
| get_callbacks_for_hook (string $hookclassname) |
| Returns list of callbacks for given hook name.
|
|
| get_hooks_deprecating_plugin_callback (string $plugincallback) |
| If the plugin callback from lib.php is deprecated by any hooks, return the hooks' classnames.
|
|
| get_hooks_with_callbacks () |
| Returns the list of Hook class names that have registered callbacks.
|
|
| getListenersForEvent (object $event) |
| Get the list of listeners for the specified event.
|
|
| is_deprecated_plugin_callback (string $plugincallback) |
| Is the plugin callback from lib.php deprecated by any hook?
|
|
| is_deprecating_hook_present (string $component, string $plugincallback) |
| Is there a hook callback in component that deprecates given lib.php plugin callback?
|
|
| phpunit_redirect_hook (string $hookname, callable $callback) |
| Override hook callbacks for testing purposes.
|
|
| phpunit_stop_redirections () |
| Cancel all redirections of hook callbacks.
|
|
|
static | discover_known_hooks () |
| Returns list of hooks discovered through hook namespaces or discovery agents.
|
|
static | get_instance () |
| Factory method, returns instance of manager that serves as hook dispatcher and callback provider.
|
|
static | get_replaced_callbacks (string $hookclassname) |
| Get the list of callbacks that the given hook class replaces (if any).
|
|
static | phpunit_get_instance (array $componentfiles) |
| Factory method for testing of hook manager in PHPUnit tests.
|
|
◆ discover_known_hooks()
static core\hook\manager::discover_known_hooks |
( |
| ) |
|
|
static |
Returns list of hooks discovered through hook namespaces or discovery agents.
The hooks overview page includes also all other classes that are referenced in callback registrations in db/hooks.php files, those are not included here.
- Return values
-
◆ dispatch()
core\hook\manager::dispatch |
( |
object | $event | ) |
|
Provide all relevant listeners with an event to process.
- Parameters
-
object | $event | The object to process (aka hook). |
- Return values
-
object | The Event that was passed, now modified by listeners. |
Implements Psr\EventDispatcher\EventDispatcherInterface.
◆ get_all_callbacks()
core\hook\manager::get_all_callbacks |
( |
| ) |
|
Returns list of all callbacks found in db/hooks.php files.
- Return values
-
◆ get_callbacks_for_hook()
core\hook\manager::get_callbacks_for_hook |
( |
string | $hookclassname | ) |
|
Returns list of callbacks for given hook name.
NOTE: this is the "Listener Provider" described in PSR-14, instead of instance parameter it uses real PHP class names.
- Parameters
-
string | $hookclassname | PHP class name of hook |
- Return values
-
array | list of callback definitions |
◆ get_hooks_deprecating_plugin_callback()
core\hook\manager::get_hooks_deprecating_plugin_callback |
( |
string | $plugincallback | ) |
|
If the plugin callback from lib.php is deprecated by any hooks, return the hooks' classnames.
- Parameters
-
string | $plugincallback | short callback name without the component prefix |
- Return values
-
◆ get_hooks_with_callbacks()
core\hook\manager::get_hooks_with_callbacks |
( |
| ) |
|
Returns the list of Hook class names that have registered callbacks.
- Return values
-
◆ get_instance()
static core\hook\manager::get_instance |
( |
| ) |
|
|
static |
Factory method, returns instance of manager that serves as hook dispatcher and callback provider.
- Return values
-
◆ get_replaced_callbacks()
static core\hook\manager::get_replaced_callbacks |
( |
string | $hookclassname | ) |
|
|
static |
Get the list of callbacks that the given hook class replaces (if any).
- Parameters
-
- Return values
-
◆ getListenersForEvent()
core\hook\manager::getListenersForEvent |
( |
object | $event | ) |
|
Get the list of listeners for the specified event.
- Parameters
-
object | $event | The object being listened to (aka hook). |
- Return values
-
iterable<callable> | An iterable (array, iterator, or generator) of callables. Each callable MUST be type-compatible with $event. Please note that in Moodle the callable must be a string. |
Implements Psr\EventDispatcher\ListenerProviderInterface.
◆ is_deprecated_plugin_callback()
core\hook\manager::is_deprecated_plugin_callback |
( |
string | $plugincallback | ) |
|
Is the plugin callback from lib.php deprecated by any hook?
- Parameters
-
string | $plugincallback | short callback name without the component prefix |
- Return values
-
- Deprecated
- in favour of get_hooks_deprecating_plugin_callback since Moodle 4.4.
- Todo
- Remove in Moodle 4.8 (MDL-80327).
◆ is_deprecating_hook_present()
core\hook\manager::is_deprecating_hook_present |
( |
string | $component, |
|
|
string | $plugincallback ) |
Is there a hook callback in component that deprecates given lib.php plugin callback?
NOTE: if there is both hook and deprecated callback then we ignore the old callback to allow compatibility of contrib plugins with multiple Moodle branches.
- Parameters
-
string | $component | |
string | $plugincallback | short callback name without the component prefix |
- Return values
-
◆ phpunit_get_instance()
static core\hook\manager::phpunit_get_instance |
( |
array | $componentfiles | ) |
|
|
static |
Factory method for testing of hook manager in PHPUnit tests.
Please note that the result of this method should typically be passed to core\di\set().
- Parameters
-
array | $componentfiles | list of hook callback files for each component. |
- Return values
-
◆ phpunit_redirect_hook()
core\hook\manager::phpunit_redirect_hook |
( |
string | $hookname, |
|
|
callable | $callback ) |
Override hook callbacks for testing purposes.
- Parameters
-
string | $hookname | |
callable | $callback | |
The documentation for this class was generated from the following file:
- lib/classes/hook/manager.php