function ca_add_condition_group in Ubercart 6.2
Add a new condition group to a predicate.
Parameters
$pid: The ID of the predicate to add the condition group to.
Return value
An array representing the full, updated predicate.
1 call to ca_add_condition_group()
- ca_conditions_form_add_condition_group_submit in ca/
ca.admin.inc - Submit handler for button to add a condition group.
File
- ca/
ca.module, line 777 - This is a demonstration module for the new conditional actions API.
Code
function ca_add_condition_group($pid) {
// Load the predicate.
$predicate = ca_load_predicate($pid);
// Add the condition group to the conditions array in the appropriate place.
if (empty($predicate['#conditions'])) {
$predicate['#conditions'] = ca_new_conditions();
}
else {
$predicate['#conditions']['#conditions'][] = array(
'#operator' => 'AND',
'#conditions' => array(),
);
}
// Save the changes.
ca_save_predicate($predicate);
return $predicate;
}