diff --git a/beike/Helpers.php b/beike/Helpers.php index 5f99a5c9..65d9e235 100644 --- a/beike/Helpers.php +++ b/beike/Helpers.php @@ -1,5 +1,6 @@ get($hook, $params, $callback, $htmlContent); + } + + + /** + * @param string $hook + * @param array $params + * @param callable|null $callback + * @param string $htmlContent + * @return string|void|null + */ + public function getWrapper(string $hook, array $params = [], callable $callback = null, string $htmlContent = '') + { + if (config('app.debug')) { + Debugbar::log("HOOK === @hookwrapper: {$hook}"); + } + return $this->get($hook, $params, $callback, $htmlContent); + } + /** * Stop all another hook running. * diff --git a/beike/Hook/HookServiceProvider.php b/beike/Hook/HookServiceProvider.php index 21c5f1a0..9c7297cf 100644 --- a/beike/Hook/HookServiceProvider.php +++ b/beike/Hook/HookServiceProvider.php @@ -44,7 +44,7 @@ class HookServiceProvider extends ServiceProvider { $__definedVars = []; } - $output = \Hook::get("' . $name . '",["data"=>$__definedVars],function($data) { return null; }); + $output = \Hook::getHook("' . $name . '",["data"=>$__definedVars],function($data) { return null; }); if ($output) echo $output; ?>'; @@ -78,7 +78,7 @@ class HookServiceProvider extends ServiceProvider $__definedVars = []; } $__hook_content = ob_get_clean(); - $output = \Hook::get("$__hook_name",["data"=>$__definedVars],function($data) { return null; },$__hook_content); + $output = \Hook::getWrapper("$__hook_name",["data"=>$__definedVars],function($data) { return null; },$__hook_content); unset($__hook_name); unset($__hook_content); if ($output)