Hook can return values
This commit is contained in:
parent
710ef7e9fa
commit
5baac9d7d0
@ -45,13 +45,14 @@ function register_hook($action, $function){
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function run_hook($action){
|
function run_hook($action, $args = []){
|
||||||
global $hook_registered;
|
global $hook_registered;
|
||||||
foreach($hook_registered as $hook){
|
foreach($hook_registered as $hook){
|
||||||
if($hook['action'] == $action){
|
if($hook['action'] == $action){
|
||||||
if(function_exists($hook['function'])){
|
if(function_exists($hook['function'])){
|
||||||
call_user_func($hook['function']);
|
return call_user_func($hook['function'], $args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user