Create Custom Hook


#1

Is there any way to create a custom hook that other plugins can subscribe to? I see that custom helpers can be added, but I want to send events to subscribed listeners.


#2

Yep, that's fairly easy. You don't need to register anything, just fetch your hook from the plugin manager.

An example is contained in the bundled Software Update plugin which uses this to allow plugins to declare their own update configurations, see here. That line is basically all there is to it, the plugin is just fetching hooks for a specific hook name that it declared itself. If there's any plugin that has a handler registered for that hook, that handler will be returned.


#3

That's great! I am coordinating with a few folks who are developing their own plugins to interact with Octolapse, and this will be perfect. Thanks for pointing me in the right direction!