98
edits
m (→Introduction) |
m (→Introduction) |
||
| Line 12: | Line 12: | ||
Every hook has a name, eg. "doActions" found in this code: $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); | Every hook has a name, eg. "doActions" found in this code: $reshook=$hookmanager->executeHooks('doActions',$parameters,$object,$action); | ||
However the hook name is often not unique, so | However the hook name is often not unique (may be repeated in various code modules), so to identify the location accurately, code modules have a "context" name that will be referred to by all hooks in that code module location. | ||
So to use a hook, you need to know its context (its location) and | So to use a hook, you need to know its context name (its location) and the hook name. | ||
* The Hook Context | * The Hook Context Name (e.g.: "productcard" for products, "invoicecard" for invoices, etc..). can be found by searching for "'''initHooks('''" in the php files. | ||
This will find results such as "$hookmanager->initHooks(array('thirdpartycomm','globalcard'));" where "thirdpartycomm" is the context. | This will find results such as "$hookmanager->initHooks(array('thirdpartycomm','globalcard'));" where "thirdpartycomm" is the context. | ||
* The Hook | * The Hook Name can be found by searching for "'''executeHooks('''" in the block of code you are interest in modifying...possibly there may be no hook defined so you may add your own (and submit a corresponding pull-request in Githbub so it gets including in future version). | ||
This will find results such as "$reshook = $hookmanager->executeHooks('addMoreBoxStatsCustomer', $parameters, $object, $action);" where "addMoreBoxStatsCustomer" is the Hook name. | This will find results such as "$reshook = $hookmanager->executeHooks('addMoreBoxStatsCustomer', $parameters, $object, $action);" where "addMoreBoxStatsCustomer" is the Hook name. | ||
edits