You are here

function rules_admin_determine_operation in Rules 6

Determines which operation should be added If the parent operation is an AND, we add an OR, and vice versa.

1 call to rules_admin_determine_operation()
rules_admin_form_add_op in rules_admin/rules_admin.rule_forms.inc
Indenting a condition Adds a logical operation and place the given condition element inside. We automatically determine which operation is to be added.

File

rules_admin/rules_admin.rule_forms.inc, line 882

Code

function rules_admin_determine_operation(&$proxy, $id) {
  $parent = $proxy
    ->get_element($proxy
    ->get_element_parent_id($id)) + array(
    '#type' => '',
  );
  switch ($parent['#type']) {
    default:
    case 'rule':
    case 'AND':
      return 'OR';
    case 'OR':
      return 'AND';
  }
}