#2339 - Tidy up hook call pattern

Identifier #2339
Issue type Feature request or suggestion
Title Tidy up hook call pattern
Status Completed
Handling member Chris Graham
Addon core
Description We currently do like...

$hooks = find_all_hooks('systems', 'SOME_HOOK_TYPE');
foreach (array_keys($hooks) as $hook) {
require_code('hooks/systems/SOME_HOOK_TYPE/' . $hook);
$ob = object_factory('Hook_SOME_HOOK_TYPE_' . $hook);
$ob->DO_SOMETHING();
}

We would instead do like...

$hooks = instantiate_all_hooks('systems', 'SOME_HOOK_TYPE');
foreach ($hooks as $ob) {
$ob->DO_SOMETHING();
}

Implement the API for this, then apply throughout our code. Allow the old mechanism to work still though, find_all_hooks is still a useful function that instantiate_all_hooks can use.
Steps to reproduce

Funded? No
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Rating

Unrated