You are here

function uc_taxes_ca_predicate in Ubercart 6.2

Implements hook_ca_predicate().

Create a predicate for each event corresponding to a tax rule.

File

uc_taxes/uc_taxes.ca.inc, line 86
This file contains the Conditional Action hooks and functions necessary to make the tax related entity, conditions, events, and actions work.

Code

function uc_taxes_ca_predicate() {
  $predicates = array();

  // Loop through all the defined tax rates.
  foreach (uc_taxes_rate_load() as $rate) {
    $predicates['uc_taxes_' . $rate->id] = array(
      '#title' => $rate->name,
      '#class' => 'taxes',
      '#trigger' => 'calculate_taxes',
      '#status' => 1,
      '#actions' => array(
        array(
          '#name' => 'uc_taxes_action_apply_tax_' . $rate->id,
          '#title' => t('Apply !name', array(
            '!name' => $rate->name,
          )),
          '#argument_map' => array(
            'order' => 'order',
            'tax' => 'tax',
          ),
        ),
      ),
    );
  }
  return $predicates;
}