(no description)
File Size: | 622 lines (22 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
manager:: (9 methods):
__construct()
get_instance()
phpunit_get_instance()
phpunit_redirect_hook()
phpunit_stop_redirections()
get_callbacks_for_hook()
get_all_callbacks()
getListenersForEvent()
is_callback_valid()
name:: (10 methods):
get_hooks_with_callbacks()
dispatch()
init_standard_callbacks()
load_callbacks()
load_callback_overrides()
calculate_overrides_hash()
prioritise_callbacks()
fetch_deprecated_callbacks()
add_component_callbacks()
normalise_callback()
method:: (3 methods):
is_deprecated_plugin_callback()
is_deprecating_hook_present()
discover_known_hooks()
__construct() X-Ref |
Constructor can be used only from factory methods. |
get_instance() X-Ref |
Factory method, returns instance of manager that serves as hook dispatcher and callback provider. return: self |
phpunit_get_instance(array $componentfiles) X-Ref |
Factory method for testing of hook manager in PHPUnit tests. param: array $componentfiles list of hook callback files for each component. return: self |
phpunit_redirect_hook(string $hookname, callable $callback) X-Ref |
Override hook callbacks for testing purposes. param: string $hookname param: callable $callback return: void |
phpunit_stop_redirections() X-Ref |
Cancel all redirections of hook callbacks. return: void |
get_callbacks_for_hook(string $hookclassname) X-Ref |
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. param: string $hookclassname PHP class name of hook return: array list of callback definitions |
get_all_callbacks() X-Ref |
Returns list of all callbacks found in db/hooks.php files. return: iterable |
getListenersForEvent(object $event) X-Ref |
Get the list of listeners for the specified event. param: object $event The object being listened to (aka hook). return: iterable<callable> |
is_callback_valid(string $component, string $callback) X-Ref |
Verify that callback is valid. param: string $component param: string $callback return: bool |
get_hooks_with_callbacks() X-Ref |
Returns the list of Hook class names that have registered callbacks. return: array |
dispatch(object $event) X-Ref |
Provide all relevant listeners with an event to process. param: object $event The object to process (aka hook). return: object The Event that was passed, now modified by listeners. |
init_standard_callbacks() X-Ref |
Initialise list of all callbacks for each hook. return: void |
load_callbacks(array $componentfiles) X-Ref |
Load callbacks from component db/hooks.php files. param: array $componentfiles list of all components with their callback files return: void |
load_callback_overrides() X-Ref |
In extremely special cases admins may decide to override callbacks via config.php setting. |
calculate_overrides_hash() X-Ref |
Calculate a hash of the overrides. This is used to inform if the overrides have changed, which invalidates the cache. Overrides are only configured in config.php where there is no other mechanism to invalidate the cache. return: null|string |
prioritise_callbacks() X-Ref |
Prioritise the callbacks. |
fetch_deprecated_callbacks() X-Ref |
Fetch the list of callbacks that this hook replaces. |
add_component_callbacks(string $component, string $hookfile) X-Ref |
Add hook callbacks from file. param: string $component component where hook callbacks are defined param: string $hookfile file with list of all callbacks for component return: void |
normalise_callback(string $component, array $callback) X-Ref |
Normalise the callback class::method value. param: string $component param: array $callback return: null|string |
is_deprecated_plugin_callback(string $plugincallback) X-Ref |
Is the plugin callback from lib.php deprecated by any hook? param: string $plugincallback short callback name without the component prefix return: bool |
is_deprecating_hook_present(string $component, string $plugincallback) X-Ref |
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. param: string $component param: string $plugincallback short callback name without the component prefix return: bool |
discover_known_hooks() X-Ref |
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: array hook class names |