You are here

function rules_configure in Rules 6

A simple helping function, which eases the creation of rules Example use case: $conditions = rules_configure('OR', $condition1, conditions2);

Parameters

$op One supported operation like 'AND', 'OR'. If ommitted the passed elements: will just be added to the first one.

$elements The elements to configure.:

2 calls to rules_configure()
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.
rules_admin_form_edit_save in rules_admin/rules_admin.rule_forms.inc
Actually saves the element. Note that this handles also saving newly added elements.

File

rules/rules.module, line 627
Rules engine module

Code

function rules_configure() {
  $args = func_get_args();
  $op = array_shift($args);
  if (!is_string($op) && is_array($op)) {

    //just add the elements to the first element
    return array_merge($op, $args);
  }
  $op = strtoupper($op);
  $element = rules_use_element($op);
  $element += $args;
  return $element;
}