Bureaucrats, emailconfirmed, Administrators
149
edits
Rdoursenaud (talk | contribs) (Better wording) |
|||
| Line 2: | Line 2: | ||
= Introduction = | = Introduction = | ||
Hooks | Hooks are a developer feature available since Dolibarr 3.2. | ||
On the contrary | It allows developers to add custom code to Dolibarr core without the need to resort to patching. | ||
* Hooks are enabled or not for a "context" (ie the module, eg: "productcard" for products, "invoicecard" for invoices, etc..). It's easy to find them, just search for "'''initHooks('''" into php files. | On the contrary of the [[triggers]] (another feature to interact with Dolibarr core code) − which are by definition linked to a business action − hooks can happen anywhere at anytime, they are entry points into the program. | ||
* Hooks are | * Hooks are enabled or not for a "context" (ie the module, eg: "productcard" for products, "invoicecard" for invoices, etc..). It's easy to find them, just search (or grep) for "'''initHooks('''" into php files. | ||
* Hooks are parts of code that can be completed or replaced by your own code. You can find all hookable part of code by searching (or grepping) for "'''executeHooks('''". | |||
= Add a hook to allow to insert code = | = Add a hook to allow to insert code = | ||