mirror of
https://github.com/processwire/processwire.git
synced 2025-08-09 08:17:12 +02:00
Fix issue processwire/processwire-issues#1067
This commit is contained in:
@@ -1024,13 +1024,16 @@ class WireHooks {
|
|||||||
if(is_array($hookID) || strpos($hookID, ',')) {
|
if(is_array($hookID) || strpos($hookID, ',')) {
|
||||||
return $this->removeHooks($object, $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);
|
list($hookClass, $priority, $method) = explode(':', $hookID);
|
||||||
if(empty($hookClass)) {
|
if(empty($hookClass)) {
|
||||||
|
// local hook
|
||||||
$localHooks = $object->getLocalHooks();
|
$localHooks = $object->getLocalHooks();
|
||||||
unset($localHooks[$method][$priority]);
|
unset($localHooks[$method][$priority]);
|
||||||
$object->setLocalHooks($localHooks);
|
$object->setLocalHooks($localHooks);
|
||||||
} else {
|
} else {
|
||||||
|
// static hook
|
||||||
unset($this->staticHooks[$hookClass][$method][$priority]);
|
unset($this->staticHooks[$hookClass][$method][$priority]);
|
||||||
if(empty($this->staticHooks[$hookClass][$method])) {
|
if(empty($this->staticHooks[$hookClass][$method])) {
|
||||||
unset($this->hookClassMethodCache["$hookClass::$method"]);
|
unset($this->hookClassMethodCache["$hookClass::$method"]);
|
||||||
|
Reference in New Issue
Block a user