We talked briefly about this in Copenhagen, but basically with Drupal Commerce I'm looking to resolve issues like this one:
http://www.ubercart.org/forum/ideas_and_suggestions/16575/my_one_huge_gr...
Our thought is that we should have all our business logic working through Rules so there is no dichotomy. We'll encourage people to write conditions and actions for Rules as much as possible. However, I also don't see any reason to hinder a developer from simply using a hook - but I don't believe my module should be responsible for invoking a hook every time I invoke a Rules event.
What seemed like a simple solution would be for Rules to invoke its own hook with the same arguments that are passed through to the event function. I'm wondering if such a thing should happen in rules_invoke_event() or if module developers should have to intentionally use a separate function if they want Rules to invoke a related hook at the same time. I'm thinking you could take the hook_form_FORM_ID_alter() approach and define hook_rules_event_EVENT_NAME() or something...
What do you think?
Comments
Comment #1
fago>Our thought is that we should have all our business logic working through Rules so there is no dichotomy. We'll encourage people to write conditions and actions for Rules as much as possible.
Agreed + sounds great!
>However, I also don't see any reason to hinder a developer from simply using a hook - but I don't believe my module should be responsible for invoking a hook every time I invoke a Rules event.
As discussed - that makes sense to me. I've added a rules_invoke_all() function that does both in an efficient way - thus it saves some call_user_func_array() calls. Also I've improved invoking the event such that the previous call_user_func_array is saved too. :)
Comment #2
fagoComment #3
rszrama commentedWow, way to go, fago. Can't wait to tell developers about this. : )