I'm having trouble creating a small module to add an Event scenario to Rules using the Rules API. Basically, I'm creating a rule that should detect to see if certain fields of a file entity have certain values upon saving that file. Then, if the conditions are met, the action is to change the URL path alias of /video/ to point to the newest video file in my system (file/[fid])
But I'm getting stuck even creating the new Event to even work. My code below does succeed in making it appear in the Rules event list, and then when setting conditions, the Data Selector exposes the correct file fields. But, when I set a very simple condition or even no condition, my action does not fire.
(A bigger aside: shouldn't the Rules module come pre-packaged with functionality for dealing with file entities? There are plenty of events for nodes, users, and comments, but nothing for files.)
So, what is wrong with my code below?
/**
* Implementation of hook_rules_event_info().
*/
function rules_extended_rules_event_info() {
return array(
'rules_extended_rules_event_file_insert' => array(
'group' => t('Entity'),
'label' => t('After saving a new entity'),
'module' => 'rules_extended',
'variables' => array (
'file' => array ('type' => 'entity', 'label' => t('created entity')),
),
),
'rules_extended_rules_event_file_update' => array(
'group' => t('Entity'),
'label' => t('After updating an existing entity'),
'module' => 'rules_extended',
'variables' => array (
'file' => array ('type' => 'entity', 'label' => t('updated entity')),
),
),
);
}