In Drupal 6, I have made a custom Rules action in code using hook_rules_action_info()
. I want to create a rule that uses the Event: "After saving a new term", which is an Event provided by Rules in the module.
I want to make whatever taxonomy term has been created available to me in my action hook, how can I do this? Looking in taxonomy.rules.inc I see the following code for the Event:
function taxonomy_rules_event_info()
{
return array(
'taxonomy_term_insert' => array(
'label' => t('After saving a new term'),
'module' => 'Taxonomy',
'arguments' => rules_events_hook_taxonomy_term_arguments(t('created term')),
),
...
}
Judging by the Rules documentation for 6, I need to declare a taxonomy term argument in my action hook:
$actions['mymodule_notifications_notify_discussion_flagged_users'] = array(
'label' => t('Notify discussion flagged users'),
'module' => 'System',
'arguments' => array(
'taxonomy_term' => array('type' => 'taxonomy_term', 'label' => t('Term'))
)
);
Then I can pass the $term argument to the function that will perform my actions. When I inspect $term
using dpm()
, I get the following object which is an array with one empty element:
http://i.imgur.com/aD8Zz3l.png