Skip to content

Commit

Permalink
docs(): add a hook documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
tleon committed Sep 9, 2024
1 parent 00f1768 commit 1e9e58d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions contribute/contribute-pull-requests/add_hook.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# How To add a new Hook
Adding a new hook is quite a simple process. It can be done in only tree steps.

## 1) Add a call to Hook::exec()

As you can see on this [PR](https://github.com/PrestaShop/PrestaShop/pull/34431/files) Adding a simple Hook::exex() statement is enought to add a new hook. In order for it to be complete, there is a couple more steps to do.

## 2) Modify the hook.xlm file

In order to properly register the hook you need to add it to the hook.xml file as seen in this [PR](https://github.com/PrestaShop/PrestaShop/pull/34431/files)

## 3) Add the new hook in the Autoupgrade fixture

Finally, to allow your new hook to be available during an update, you need to add it to the current version SQL script of the Autoupgrade module. As it can be seen in this [PR](https://github.com/PrestaShop/autoupgrade/pull/672/files)

0 comments on commit 1e9e58d

Please sign in to comment.