Hooks are invoked by the core code as `$hooks->cat('action');` (replace action as appropriate).
To respond, a hook listens for the action to be called. This is sometimes called a Publish/Subscribe model. The listener functions are the subscribers. And each `call` or `generate` publishes to all subscribers.
File-based hooks do this with methods named `listen_action` (again replace action with the actual label). E.g. a file-based system hook would be `listen_startApplication`. A database hook listens for the defined hooks_action.
You may need to say `$hooks`, `$GLOBALS['hooks']`, `$admin_hooks`, or `$GLOBALS['admin_hooks']` depending on where you are.
In admin, each action has an associated hook. I.e. each file in admin/includes/actions/page_name/*.php has an action with the file name converted to a hook name. E.g. admin/includes/actions/manufacturers/insert.php would be `listen_insertAction` and accessed from a URL admin/manufacturers.php?action=insert (or whatever name your admin folder uses). The action is defined as a GET parameter, even though most of them must be invoked by form POST.
Hook Listeners
- burt
- Core Team
- Posts: 4550
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
- burt
- Core Team
- Posts: 4550
- Joined: Tue Oct 29, 2019 9:37 am
- Phoenix Version: v1.1.0.8
- : Buy Me A Beverage
- Has thanked: 252 times
- Been thanked: 412 times
Re: Hook Listeners
Taken from https://github.com/CE-PhoenixCart/Phoen ... -listeners
TY to Matt for making this Wiki page back in 2021
TY to Matt for making this Wiki page back in 2021
I am not here to build for you.
I am here to build with you. Let's help each other.
I am here to build with you. Let's help each other.