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
2020-01-20 07:01:01 -05:00
parent 406bd7a2ea
commit 85c9e4f329

View File

@@ -1024,13 +1024,16 @@ class WireHooks {
if(is_array($hookID) || strpos($hookID, ',')) {
return $this->removeHooks($object, $hookID);
}
if(!empty($hookID) && strpos($hookID, ':')) {
if(!empty($hookID) && substr_count($hookID, ':') === 2) {
// local hook ID ":100.0:methodName" or static hook ID "ClassName:100.0:methodName"
list($hookClass, $priority, $method) = explode(':', $hookID);
if(empty($hookClass)) {
// local hook
$localHooks = $object->getLocalHooks();
unset($localHooks[$method][$priority]);
$object->setLocalHooks($localHooks);
} else {
// static hook
unset($this->staticHooks[$hookClass][$method][$priority]);
if(empty($this->staticHooks[$hookClass][$method])) {
unset($this->hookClassMethodCache["$hookClass::$method"]);