Understanding hooks
A hook is essentially just a listener for which we've registered a callback function. These callback functions expect a single parameter: a hash that provides some context to the function. The contents of the hash depend on what type of hook is being evaluated.
There are four basic categories of hooks available in Redmine:
View hooks
Controller hooks
Model hooks
Helper hooks
For view and controller hooks, the context hash contains the following fields as well as data specific to the hook being used:
:project
: This is the current project:request
: This contains the current web request instance:controller
: This contains the current controller instance:hook_caller
: This holds the object that called the hook
Note
The full list of available hooks is maintained at http://www.redmine.org/projects/redmine/wiki/Hooks_List.
To quickly build the hook list for the version of Redmine you have installed, run the following commands:
cd /path/to/redmine/app grep -r call_hook *
By doing this from...