This hook is invoked on the moment the condition is parsed to a sql condition on the query builder
CRM_Triggers_BAO_TriggerRuleSchedule $rule_schedule
CRM_Triggers_QueryBuilder $builder
CRM_Triggers_QueryBuilder_Subcondition $where
CRM_Triggers_QueryBuilder_Subcondition $having
CRM_Triggers_BAO_TriggerRule $trigger_rule
Below an example of usage of hook which will set the is_active condition on the dao when the field_name is contact_id. This example is probably useless :-)
function hook_civicrm_trigger_condition_parse(CRM_Triggers_BAO_TriggerRuleSchedule $rule_schedule, CRM_Triggers_QueryBuilder $builder CRM_Triggers_QueryBuilder_Subcondition $where, CRM_Triggers_QueryBuilder_Subcondition $having, CRM_Triggers_BAO_TriggerRule $trigger_rule) {
if ($rule_schedule->name == 'start_donor_journey') {
$cond = new CRM_Triggers_QueryBuilder_Condition("is_active = 1");
$where->addCondition($cond); //only active contacts
}
}
This hook is invoked on the moment the parameters for the action execution are parsed.
The definition of this hook looks like
function hook_civicrm_trigger_action_parse_params(&$return, $params, $objects, CRM_Triggers_BAO_TriggerRule $trigger_rule, CRM_Triggers_BAO_ActionRule $action);
You can set parameters in the variable $return
.
$return
This is an array you can set which is used the execution of the action$params
this is an array with the source parametersarray $objects
this is the entity which is processedCRM_Triggers_BAO_RuleSchedule $rule_schedule
this is actual triggerCRM_Triggers_BAO_ActionRule $action
this is the actual action
function hook_civicrm_trigger_action_parse_params(&$return, $params, $objects, CRM_Triggers_BAO_RuleSchedule $rule_schedule, CRM_Triggers_BAO_ActionRule $action) {
if ($action->name == 'GroupMovement' and $action->entity == 'GroupContact') {
$return['group_id'] = 21;//use group 21 for the action
}
}
Todo
Todo