You are here

function ca_evaluate_conditions in Ubercart 6.2

Evaluate a predicate's conditions.

Parameters

$predicate: A fully loaded predicate array.

$arguments: The array of parsed arguments for the trigger.

Return value

TRUE or FALSE indicating the success or failure of the evaluation.

6 calls to ca_evaluate_conditions()
ca_pull_trigger in ca/ca.module
Pull a trigger and evaluate any predicates associated with that trigger.
hook_calculate_tax in docs/hooks.php
Calculates tax line items for an order.
uc_checkout_pane_quotes in shipping/uc_quote/uc_quote.module
Shipping quote checkout pane callback.
uc_order_pane_quotes in shipping/uc_quote/uc_quote.module
Shipping quote order pane callback.
uc_taxes_calculate_tax in uc_taxes/uc_taxes.module
Calculates the amount and types of taxes that apply to an order.

... See full list

File

ca/ca.module, line 346
This is a demonstration module for the new conditional actions API.

Code

function ca_evaluate_conditions($predicate, $arguments) {

  // Automatically pass if there are no conditions.
  if (!isset($predicate['#conditions']) || count($predicate['#conditions']) == 0) {
    return TRUE;
  }

  // Load the data for the conditions as defined by modules.
  $condition_data = module_invoke_all('ca_condition');

  // Recurse through the predicate's conditions for evaluation.
  $result = _ca_evaluate_conditions_tree($predicate['#conditions'], $arguments, $condition_data);
  if (is_null($result)) {
    $result = FALSE;
  }
  return $result;
}