31,003
edits
(→Usage) |
|||
| Line 101: | Line 101: | ||
print_r($object); | print_r($object); | ||
if ($parameters | if (in_array('somecontext',explode(':',$parameters['context']))) | ||
{ | { | ||
// do something only for the context 'somecontext' | // do something only for the context 'somecontext' | ||
| Line 110: | Line 110: | ||
where | where | ||
* '''$parameters''' is an array of meta-data about the datas contained by the hook (eg: the context, always accessible by $parameters | * '''$parameters''' is an array of meta-data about the datas contained by the hook (eg: the context, always accessible by $parameters['context']). | ||
* '''$object''' is the object that you may work on. Eg: the product if you are in the productcard context. | * '''$object''' is the object that you may work on. Eg: the product if you are in the productcard context. | ||
* '''$action''' is the action if one is conveyed (generally "create", "edit" or "view"). | * '''$action''' is the action if one is conveyed (generally "create", "edit" or "view"). | ||