$hooks API variable / WireHooks class

WireHooks located in file /wire/core/WireHooks.php

Click any linked item for full usage details and examples. Hookable methods are indicated with the icon.

Show $var?             Show args?        

Common

NameReturnSummary 
$hooks->addHook(Wire $object, $method, $toObject)
stringHook a function/method to a hookable method call in this object 
$hooks->allowPathHooks()
boolGet or set whether path hooks are allowed 
$hooks->className()
string@return string 
$hooks->filterHooks(array $hooks, string $property, $value)
arrayFilter and return hooks matching given property and value 
$hooks->filterPathHooks(string $requestPath)
array boolReturn path hooks that have potential to match given request path 
$hooks->getAllLocalHooks()
arrayReturn the "all local hooks" cache 
$hooks->getAllPathHooks()
arrayReturn all pending path hooks 
$hooks->getClassParents($object)
arrayGet an array of parent classes and interfaces for the given object 
$hooks->getHooks(Wire $object)
arrayReturn all hooks associated with $object or method (if specified) 
$hooks->getPathHookRedirect()
stringReturn redirect URL required by an applicable path hook, or blank otherwise 
$hooks->hasHook(Wire $object, string $method)
boolSimilar to isHooked(), returns true if the method or property hooked, false if it isn't. 
$hooks->hasPathHooks()
boolReturn whether or not any path hooks are pending 
$hooks->isHooked(string $method)
boolReturns true if the method/property hooked, false if it isn't. 
$hooks->isMethodHooked($class, string $method)
boolSimilar to isHooked() method but also checks parent classes for the hooked method as well 
$hooks->isPropertyHooked($class, string $property)
boolSimilar to isHooked() method but also checks parent classes for the hooked property as well 
$hooks->removeHook(Wire $object, $hookID)
WireGiven a Hook ID provided by addHook() this removes the hook 
$hooks->runHooks(Wire $object, string $method, array $arguments)
arrayProvides the implementation for calling hooks in ProcessWire 

API reference based on ProcessWire core version 3.0.244

Latest news

  • ProcessWire Weekly #558
    In the 558th issue of ProcessWire Weekly we'll check out the blog post that introduces ProcessWire 3.0.244, share some recent ProcessWire highlights, and more. Read on!
    Weekly.pw / 18 January 2025
  • ProcessWire 3.0.244 new main/master version
    ProcessWire 3.0.244 is our newest main/master/stable version. It's been more than a year in the making and is packed with tons of new features, issue fixes, optimizations and more. This post covers all the details.
    Blog / 18 January 2025
  • Subscribe to weekly ProcessWire news

“To Drupal, or to ProcessWire? The million dollar choice. We decided to make an early switch to PW. And in retrospect, ProcessWire was probably the best decision we made. Thanks are due to ProcessWire and the amazing system and set of modules that are in place.” —Unni Krishnan, Founder of PigtailPundits