Skip to content
Kelvin Mo edited this page Jul 24, 2021 · 5 revisions

What are hooks?

SimpleID uses "hooks" to interact with extensions.

A hook is a PHP function which follows particular conventions. These are:

  • The name of a function is always in the form of extension_hook(), where extension is the name of the extension (thus with the file name extension.extension.php) and hook is the name of the hook.
  • Each hook has a defined set of parameters and a specified result type.

How do I use hooks?

Thus to extend SimpleID, an extension has to implement one or more hooks. When required, SimpleID determines which extensions implement a hook and call that hook in all enabled extensions that implement it.

Where can I get a list of hooks?

A list of hooks available can be found in /extensions/hooks.php. This page lists all the hooks for a generic extension with the name hook. For example, hook_checkid describes the checkid hook, which can be implemented by an extension with the name example using the example_checkid function.