Hooks are available to plugins to tell the application when you call the relevant functions.
For example, a plugin that connects with a third-party service to update every time a new order is received needs to be called when the user checks-out.
There are different types of hooks available for plugins to use.
If the plugin needs to process the data from the application and it wants the application to wait while it performs the actions you call an interrupting hook.
In other cases you might not need this. For example, you want to send an SMS to the customer once the customer has placed an order. In this case you can call a non-interrupting hook. The plugin operation will be handled in parallel as a job.
Registering a hook
Plugins can register hooks by using reserved function names. For example, if a plugin has a method
i_order_hook() then it will be registered as an interrupting order hook.
If the function you are writing is reserved and it begins with
i_ then it implied that it is an interrupting hook.