1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-08 15:57:01 +02:00
This commit is contained in:
Ryan Cramer
2016-12-19 12:34:59 -05:00
parent 315251fa04
commit 2570d6c86d

View File

@@ -276,13 +276,27 @@ class WireHooks {
protected function isHookedOrParents($class, $method, $type = 'either') {
$property = '';
$className = is_object($class) ? wireClassName($class) : $class;
if(is_object($class)) {
$className = wireClassName($class);
$object = $class;
} else {
$className = $class;
$object = null;
}
if($object) {
// first check local hooks attached to this instance
$localHooks = $object->getLocalHooks();
if(!empty($localHooks[rtrim($method, '()')])) {
return true;
}
}
if($type == 'method' || $type == 'either') {
if(strpos($method, '(') === false) $method .= '()';
if($type == 'either') $property = rtrim($method, '()');
}
if($type == 'method') {
if(!isset($this->hookMethodCache[$method])) return false; // not hooked for any class
$hooked = isset($this->hookClassMethodCache["$className::$method"]);