[development] Actions in core
Barry Jaspan
barry at jaspan.org
Tue May 1 23:46:23 UTC 2007
John,
I'm really glad that Actions is getting some serious attention. I
used Actions (and Workflow) in a pretty big way last year and learned
to see them as the basis of "Drupal's scripting language."
For background (to explain my feature request), I built Classified Ads
functionality, complete with e-commerce integration, editorial review,
a "revision required" state, publication, and expiration. I even have
credit cards get authorized when the ad node is submitted but not
charged until it is published. It is all driven by Workflow using
several custom actions (particularly for e-commerce integration) and
very little additional code.
One of my meta-actions is "Convert this node into an EC product." The
config form lets me specify product price, among other things. I
needed to assign different prices based on the taxonomy term the user
selected for the ad (job postings cost more than free stuff postings).
So I ended up adding another field to my config form called "filter"
that says "only perform this action on a node if it has the selected
term." I can then create a separate instance of my meta-action for
each term, assigning the appropriate price to each. When a node is
created, the action set to filter to that node's term sets the price
and productizes the node; the others just return because of the
filter. It works great.
However, I have another action that also needs term filtering. I had
to add the same filtering code to both.
So, what I really want is a module that implements
"hook_action_form_alter()" that can add my term filtering to any
action config form, get notified when the action is invoked, and
decide whether or not it should execute. hook_action_form_alter()
should have a $op argument for: 'form', 'validate', 'pre-execute' (can
return false to prevent execution), 'execute' (action just executed),
maybe others too.
Thanks,
Barry
More information about the development
mailing list