Reaction Commerce Forums

Hooks. How do we improve them?


Right now we have three different types of Hooks: Event, Collection, and Method hooks, all implemented slightly differently. Right now our implementation of Event hooks works, but it doesn’t have a lot of functionality, but this seems like an area where a good Event hook system could be of use to a low of people who want to add functionality without modifying core code.

What sort of functionality would you like to see added?

For me I would like to see (for all hooks, not just Event)

  1. The ability to remove or replace a hook.
  2. The ability to see what is currently attached to a hook.
  3. Some sort of verification that an Event is available for a hook, so you can’t add hooks that will never get fired.
  4. Events added for things that don’t currently have hooks, but users may want to add Hook.
  5. The ability to execute a Method and bypass Hooks (similar to direct with Collections). This is also super helpful for testing to eliminate side-effects.