dolibarr 19.0.4
|
Class to manage hooks. More...
Public Member Functions | |
__construct ($db) | |
Constructor. | |
initHooks ($arraycontext) | |
Init array $this->hooks with instantiated action controlers. | |
executeHooks ($method, $parameters=array(), &$object=null, &$action='') | |
Execute hooks (if they were initialized) for the given method. | |
Class to manage hooks.
Definition at line 30 of file hookmanager.class.php.
HookManager::__construct | ( | $db | ) |
Constructor.
Definition at line 65 of file hookmanager.class.php.
HookManager::executeHooks | ( | $method, | |
$parameters = array(), | |||
& | $object = null, | ||
& | $action = '' ) |
Execute hooks (if they were initialized) for the given method.
string | $method | Name of method hooked ('doActions', 'printSearchForm', 'showInputField', ...) |
array | $parameters | Array of parameters |
Object | $object | Object to use hooks on |
string | $action | Action code on calling page ('create', 'edit', 'view', 'add', 'update', 'delete'...) |
Definition at line 156 of file hookmanager.class.php.
References dol_syslog(), and getDolGlobalInt().
HookManager::initHooks | ( | $arraycontext | ) |
Init array $this->hooks with instantiated action controlers.
First, a hook is declared by a module by adding a constant MAIN_MODULE_MYMODULENAME_HOOKS with value 'nameofcontext1:nameofcontext2:...' into $this->const of module descriptor file. This makes $conf->hooks_modules loaded with an entry ('modulename'=>array(nameofcontext1,nameofcontext2,...)) When initHooks function is called, with initHooks(list_of_contexts), an array $this->hooks is defined with instance of controler class found into file /mymodule/class/actions_mymodule.class.php (if module has declared the context as a managed context). Then when a hook executeHooks('aMethod'...) is called, the method aMethod found into class will be executed.
string[] | $arraycontext | Array list of searched hooks tab/features. For example: 'thirdpartycard' (for hook methods into page card thirdparty), 'thirdpartydao' (for hook methods into Societe), ... |
Definition at line 82 of file hookmanager.class.php.
References dol_include_once(), and dol_syslog().