Home / Developer Reference / Hook System Summary

Hook System Summary

addAction, addFilter, priority

What it is

The hook system lets addons run code at specific points without modifying core. Use HookManager::addAction() for actions (run code when something happens) and HookManager::addFilter() for filters (modify a value before it is used).

How to use

HookManager::addAction('slack_invoice_created', function($data) {
    // $data contains invoice_id, client_id
}, 10);

HookManager::addFilter('client_domain_manage_action', function($handled, $manageAction, $domain, $domainId, $registrar, $client) {
    if ($manageAction === 'my_action') { /* handle */ return true; }
    return $handled;
}, 10, 6);

Full reference

See the Hooks Reference (Addons and Modules section) for the complete list of every hook, when it fires, and what parameters it receives.

Was this helpful?

Tags: Developer