phpMv -UI toolkit 2.4.12
jQuery, jQuery UI, Twitter Bootstrap and Semantic-UI library for php & php MVC Frameworks
Loading...
Searching...
No Matches
BaseHooksTrait.php
Go to the documentation of this file.
1<?php
2
4
6 protected $_hooks=[];
7
12 public function hookExists($hookKey){
13 return isset($this->_hooks[$hookKey]);
14 }
15
20 public function getHook($hookKey){
21 if(isset($this->_hooks[$hookKey])){
22 return $this->_hooks[$hookKey];
23 }
24 return null;
25 }
26
32 public function addHook($hookKey,$callable){
33 $this->_hooks[$hookKey]=$callable;
34 }
35
42 public function execHook($hookKey,...$variables){
43 if(($hook=$this->getHook($hookKey))!=null){
44 return call_user_func_array($hook,$variables);
45 }
46 return;
47 }
48}
49
execHook($hookKey,... $variables)
Executes the hook with key $hookKey.
addHook($hookKey, $callable)
Adds a new Hook.