HookTrait¶
-
trait
atk4\core\
HookTrait
¶ Source: vendor/atk4/core/src/HookTrait.php#5
Properties¶
-
public static property
atk4\core\HookTrait::$
_hookTrait
¶ - Check this property to see if trait is present in the object.
Source: vendor/atk4/core/src/HookTrait.php#12 Type: bool
-
protected static property
atk4\core\HookTrait::$
hooks
¶ - Contains information about configured hooks (callbacks).
Source: vendor/atk4/core/src/HookTrait.php#19 Type: array
Methods¶
-
public
atk4\core\HookTrait::
addHook
($hook_spot, $callable, $arguments=null, $priority=null)¶ - Add another callback to be executed during hook($hook_spot);.If priority is negative, then hooks will be executed in reverse order.
Source: Parameters: - $hook_spot (string) Hook identifier to bind on
- $callable (object | callable) Will be called on hook()
- $arguments (array) Arguments are passed to $callable
- $priority (int) Lower priority is called sooner
Returns: $this
-
public
atk4\core\HookTrait::
removeHook
($hook_spot)¶ - Delete all hooks for specified spot.
Source: Parameters: - $hook_spot (string) Hook identifier to bind on
Returns: $this
-
public
atk4\core\HookTrait::
hookHasCallbacks
($hook_spot)¶ - Returns true if at least one callback is defined for this hook.
Source: Parameters: - $hook_spot (string) Hook identifier
Returns: bool
-
public
atk4\core\HookTrait::
hook
($hook_spot, $arg=null)¶ - Execute all callables assigned to $hook_spot.
Source: Parameters: - $hook_spot (string) Hook identifier
- $arg (array) Additional arguments to callables
Throws: Returns: mixed Array of responses or value specified to breakHook
-
public
atk4\core\HookTrait::
breakHook
($return)¶ - When called from inside a hook callable, will stop execution of othercallables on the same hook. The passed argument will be returned by thehook method.
Source: Parameters: - $return (mixed) What would hook() return?
Throws: