$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.236

Latest news

  • ProcessWire Weekly #515
    In the 515th issue of ProcessWire Weekly we’ll check out the latest core updates, new modules, and more. Read on!
    Weekly.pw / 23 March 2024
  • Invoices Site Profile
    The new invoices site profile is a free invoicing application developed in ProcessWire. It enables you to create invoices, record payments to them, email invoices to clients, print invoices, and more. This post covers all the details.
    Blog / 15 March 2024
  • 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