Allow user to manage hooks
Definition at line 8 of file Hooks.php.
| __construct |
( |
& |
$context | ) |
|
ctor. Initialize context for having them passed to hook as parameter
Definition at line 36 of file Hooks.php.
39 $this->currentHook = array();
Getter
Definition at line 108 of file Hooks.php.
112 case "currentHook":
return end($this->currentHook);
114 throw new \Exception(
"Cannot access attribute {$key}");
- Parameters
-
- Returns
- boolean Check if $hookName is treating
Definition at line 86 of file Hooks.php.
88 foreach ($this->currentHook as $i)
89 if ($i->hookName == $hookName)
| loadHooks |
( |
|
$hookEntities | ) |
|
- Parameters
-
| array( | Entity) $module_hookEntities entities to load Reload hooks from entities |
Definition at line 98 of file Hooks.php.
100 $this->hooks = array();
101 foreach ($hookEntities as $i)
102 $this->hooks[$i->hookName][] = (int) $i->module_id;
| register |
( |
|
$module, |
|
|
|
$hookName |
|
) |
| |
- Parameters
-
| \Tool\AModule | $module | |
| string | $hookname | Attach module $module to $hookName Can only be called while installing the module. When fired, the AModule::doAction($hookName, $context) function will be called. |
Definition at line 49 of file Hooks.php.
51 if (!\
Tools\ModuleManager::isInstalling())
52 throw new \Exception(
"You can only register hooks while installing");
| trigger |
( |
|
$hookName, |
|
|
|
$params = null |
|
) |
| |
- Parameters
-
- Returns
- number of modules successfully reached fire the hook hookName call the AModule::doAction($hookEvent) function for each attached modules
Definition at line 62 of file Hooks.php.
64 if (empty($this->hooks[$hookName]))
66 $hookEvent =
new HookEvent($hookName, $this->context, $params);
67 array_push($this->currentHook, $hookEvent);
69 foreach ($this->hooks[$hookName] as $module_id)
71 $module = $this->context->moduleManager->getModuleFromId($module_id);
74 $module->doAction($hookEvent);
77 array_pop($this->currentHook);
/core/tools/Context.php Contains website's informations
Definition at line 15 of file Hooks.php.
Contains current trigerred event
get current hook event
Definition at line 26 of file Hooks.php.
The documentation for this class was generated from the following file: