PHP Classes

File: docs/source/api/atk4/core/HookTrait.rst

Recommend this page to a friend!
  Classes of Francesco Danti   ATK4 i18next PHP   docs/source/api/atk4/core/HookTrait.rst   Download  
File: docs/source/api/atk4/core/HookTrait.rst
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: ATK4 i18next PHP
Translate application texts like il8next-PHP
Author: By
Last change:
Date: 4 years ago
Size: 3,661 bytes


Class file image Download
.. rst-class:: phpdoctorst .. role:: php(code) :language: php HookTrait ========= .. php:namespace:: atk4\core .. php:trait:: HookTrait :Source: `vendor/atk4/core/src/HookTrait.php#5 <>`_ Properties ---------- .. php:attr:: public static _hookTrait .. rst-class:: phpdoc-description | Check this property to see if trait is present in the object\. :Source: `vendor/atk4/core/src/HookTrait.php#12 <>`_ :Type: bool .. php:attr:: protected static hooks .. rst-class:: phpdoc-description | Contains information about configured hooks \(callbacks\)\. :Source: `vendor/atk4/core/src/HookTrait.php#19 <>`_ :Type: array Methods ------- .. rst-class:: public .. php:method:: public addHook( $hook_spot, $callable, $arguments=null, $priority=null) .. rst-class:: phpdoc-description | Add another callback to be executed during hook\($hook\_spot\);\. | If priority is negative, then hooks will be executed in reverse order\. :Source: `vendor/atk4/core/src/HookTrait.php#33 <>`_ :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 .. rst-class:: public .. php:method:: public removeHook( $hook_spot) .. rst-class:: phpdoc-description | Delete all hooks for specified spot\. :Source: `vendor/atk4/core/src/HookTrait.php#105 <>`_ :Parameters: * **$hook_spot** (string) Hook identifier to bind on :Returns: $this .. rst-class:: public .. php:method:: public hookHasCallbacks( $hook_spot) .. rst-class:: phpdoc-description | Returns true if at least one callback is defined for this hook\. :Source: `vendor/atk4/core/src/HookTrait.php#119 <>`_ :Parameters: * **$hook_spot** (string) Hook identifier :Returns: bool .. rst-class:: public .. php:method:: public hook( $hook_spot, $arg=null) .. rst-class:: phpdoc-description | Execute all callables assigned to $hook\_spot\. :Source: `vendor/atk4/core/src/HookTrait.php#134 <>`_ :Parameters: * **$hook_spot** (string) Hook identifier * **$arg** (array) Additional arguments to callables :Throws: :any:`\\atk4\\core\\Exception <atk4\\core\\Exception>` :Returns: mixed Array of responses or value specified to breakHook .. rst-class:: public .. php:method:: public breakHook( $return) .. rst-class:: phpdoc-description | When called from inside a hook callable, will stop execution of other | callables on the same hook\. The passed argument will be returned by the | hook method\. :Source: `vendor/atk4/core/src/HookTrait.php#187 <>`_ :Parameters: * **$return** (mixed) What would hook() return? :Throws: :any:`\\atk4\\core\\HookBreaker <atk4\\core\\HookBreaker>`