Extension to easily add hooks in your own code.

Installs: 6 462

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 2

Forks: 0

Open Issues: 0


v1.3.1 2021-04-19 08:24 UTC

This package is auto-updated.

Last update: 2024-06-19 16:00:47 UTC



Hooks mechanism for TYPO3



To call a hook, simple add the following code in any class of your code.

\Bitpatroon\Typo3Hooks\Helpers\HooksHelper::processHook(<class>, <hookname>, [<params>]);
  • Class (I) can be the instance, the static reference or the classname i.e.
    • $this
    • self
  • Hookname (II) is the name of the hook is the hook,
  • Params (III) is a y reference passed array with values for the hook.

Register the hook

In your or any localconf.php, add the hook.

        'className' => \VENDOR\CALLED_CLASS::class
  • CALLING_HOOK_CLASS is the name of the class, as specified in (I).
  • CALLED_CLASS is the name of the class, handling the hook

The class with the hook

Add a TYPO3 class CALLED_CLASS with the following code.

namespace VENDOR;

     * Hook
     * @param array $params The parameter Array
     * @param object $ref   The parent object
    public function MyHook(&$params, $ref)

Notice the $params is by reference. Changing the content affects the original array. $ref is the calling class. See (I).

Notice: Don't forget to reset the cache!