You are here

function ca_prepare_db_predicate in Ubercart 6.2

Prepare predicate data from the database into a full predicate array.

Parameters

$data: An array of data representing a row in the predicates table.

Return value

A predicate array.

3 calls to ca_prepare_db_predicate()
ca_admin in ca/ca.admin.inc
Display the administration page that lets you add and modify predicates.
ca_load_predicate in ca/ca.module
Load a predicate by its ID.
ca_load_trigger_predicates in ca/ca.module
Load predicates based on the specified parameters.

File

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

Code

function ca_prepare_db_predicate($data) {
  $predicate = array();
  foreach ($data as $key => $value) {
    switch ($key) {

      // Condition and action data needs to be unserialized.
      case 'conditions':
      case 'actions':
        $predicate['#' . $key] = unserialize($value);
        break;
      case 'ca_trigger':
        $predicate['#trigger'] = $value;
        break;
      default:
        $predicate['#' . $key] = $value;
        break;
    }
  }
  return $predicate;
}