Creating a hook

(CATTUser) #1

I need to be able to run a method in a plugin I created only when a certain click is made. It seems to me like I need to define a new hook. I think I read something about that being possible, but I can’t find any reference to it in the documentation other than a method from within my plugin being able to make notifications, which is not what I’m looking for. Is it possible to define new hooks, and if so, where and how is it done?

(vipsoft) #2

In your plugin, add the name of the custom hook that you want. See getListHooksRegistered().

Elsewhere, Piwik_PostEvent( your_custom_hook_name, pass_by_reference_data )

(Matthieu Aubry) #3

If you need a new hook in the core of Piwik in order for your plugin to work, you would need to create a ticket requesting the hook, along with a patch showing where you would need the hook, a use case for this hook, etc. We would add it in the next release.