The Hooks
We now have a broader view of how PrestaShop works, from the FO to the BO. Let’s now focus on hooks, the most important objects for module developers.
If you look at all the best CMSs around, such as WordPress, their success is highly correlated with their customization ability. As WordPress extensions enable you to add as many behaviors as you want to your blog, PrestaShop modules do the same. If you know about actions and filters in WordPress, you will understand exactly what hooks are in PrestaShop.
Our trip through the hooks world will be structured like this:
- Quick presentation of a hook
- Discovering the hook
ObjectModel
child class - Presenting the two types of hooks
- Registering/unregistering a module to a hook and implementing a module’s behavior on a hook execution
- Executing a hook
By the end of this chapter, you will know what hooks are, their types of use, how to use them, and their relationship with modules. You will...