hook_manager
class hook_manager implements hook_manager_interface
Lightweight Hook Manager (WordPress style).
Handles synchronous execution of filters and actions. Registration is handled by individual Extensions during boot.
Methods
Register a new filter callback.
Apply all filter callbacks registered for a given tag.
Register a new action callback.
Execute all action callbacks registered for a given tag.
Check if any action has been registered for a hook.
Clear all registered hooks. Essential for unit testing isolation.
Details
at line 44
static void
add_filter(string $tag, callable $function, int $priority = 10, int $args = 1)
Register a new filter callback.
at line 64
static mixed
apply_filters(string $tag, mixed $value, mixed ...$args)
Apply all filter callbacks registered for a given tag.
Each callback receives the current value and must return a (possibly modified) value.
at line 92
static void
add_action(string $tag, callable $function, int $priority = 10, int $args = 1)
Register a new action callback.
at line 108
static void
do_action(string $tag, mixed ...$args)
Execute all action callbacks registered for a given tag.
Unlike filters, actions do not return values.
at line 128
static bool
has_action(string $tag)
Check if any action has been registered for a hook.
at line 136
static void
reset()
Clear all registered hooks. Essential for unit testing isolation.