diff --git a/api/src/Hooks.php b/api/src/Hooks.php index 06d1de1fc3..c006dc0187 100644 --- a/api/src/Hooks.php +++ b/api/src/Hooks.php @@ -203,6 +203,23 @@ class Hooks return isset(self::$locations[$location]) ? array_keys(self::$locations[$location]) : array(); } + /** + * Disable a hook for this request + * + * @param string $hook + * @return boolean true if hook existed, false otherwise + */ + static public function disable($hook) + { + if (!isset(self::$locations)) self::read(); + + $ret = isset(self::$locations[$hook]); + + unset(self::$locations[$hook]); + + return $ret; + } + /** * Read all hooks into self::$locations *