hook_ca_trigger

Function hook_ca_trigger() in ca.module:
<?php
  hook_ca_trigger
()
?>

Description:

Defines the triggers that are pulled when a module wants Conditional Actions to happen. Modules may use ca_pull_trigger() to cause any predicates attached to that trigger to evaluate their conditions and if they are met, perform their actions. Triggers are passed in arguments through ca_pull_trigger(), and these are distributed to the conditions and actions as needed.

Return value:

An array which has trigger ids for keys and trigger data arrays for values. Each trigger has the following keys:

  • #title - The translated title of the trigger.
  • #category - Used to group triggers in a select list.
  • #arguments - An array of entities. The keys are used in the #argument_map of the predicates. The values are an array consisting of the #entity id and its #title.

Example:
<?php
/**
* Implementation of hook_ca_trigger().
*/
function uc_order_ca_trigger() {
 
$triggers['uc_order_status_update'] = array(
   
'#title' => t('Order status gets updated'),
   
'#category' => t('Order'),
   
'#arguments' => array(
     
'order' => array(
       
'#entity' => 'uc_order',
       
'#title' => t('Original order'),
      ),
     
'updated_order' => array(
       
'#entity' => 'uc_order',
       
'#title' => t('Updated order'),
      ),
    ),
  );

 

$triggers['uc_order_status_email_update'] = array(
   
'#title' => t('E-mail requested for order status update'),
   
'#category' => t('Order'),
   
'#arguments' => array(
     
'order' => array(
       
'#entity' => 'uc_order',
       
'#title' => t('Order'),
      ),
    ),
  );

  return

$triggers;
}
?>