function ca_load_condition in Ubercart 6.2
Load conditions defined in modules via hook_ca_condition().
Parameters
$condition: Defaults to 'all'; may instead be the name of the condition to load.
Return value
An array of data for the specified condition or an array of all the condition data if 'all' was specified. Returns FALSE if a specified condition is non-existent.
5 calls to ca_load_condition()
- ca_add_condition in ca/
ca.module - Add a new condition to a predicate.
- ca_conditions_form_add_condition_submit in ca/
ca.admin.inc - Submit handler for button to add a condition to a condition group.
- ca_load_trigger_conditions in ca/
ca.module - Return an array of conditions available for the specified trigger.
- _ca_conditions_form_condition in ca/
ca.admin.inc - Add a single condition's fieldset to the conditions form.
- _ca_conditions_form_tree in ca/
ca.admin.inc - Recursively add logical groups to the conditions form as fieldsets.
File
- ca/
ca.module, line 593 - This is a demonstration module for the new conditional actions API.
Code
function ca_load_condition($condition = 'all') {
static $conditions;
// Load the conditions defined in enabled modules to a cached variable.
if (empty($conditions)) {
$conditions = module_invoke_all('ca_condition');
}
// Return the whole array if the trigger specified is 'all'.
if ($condition === 'all') {
return $conditions;
}
// If the specified trigger is non-existent, return FALSE.
if (!isset($conditions[$condition])) {
return FALSE;
}
return $conditions[$condition];
}