You are here

function uc_taxes_event_info in Ubercart 5

Implementation of hook_event_info().

Register an event for each tax rule in {uc_taxes}.

File

uc_taxes/uc_taxes_workflow.inc, line 28
This file contains the Workflow-ng hooks and functions necessary to make the tax related entity, conditions, events, and actions work.

Code

function uc_taxes_event_info() {
  $events = array();
  $taxes = uc_taxes_get_rates();
  foreach ($taxes as $tax) {
    $events['calculate_tax_' . $tax->id] = array(
      '#label' => t('Calculate @name', array(
        '@name' => $tax->name,
      )),
      '#module' => 'uc_taxes',
      '#arguments' => array(
        'order' => array(
          '#entity' => 'order',
          '#label' => t('Order'),
        ),
        'tax' => array(
          '#entity' => 'tax',
          '#label' => t('Tax'),
        ),
        'user' => array(
          '#entity' => 'user',
          '#label' => t('User account'),
        ),
        'tax_line_item' => array(
          '#entity' => 'tax_line_item',
          '#label' => t('Line Item'),
        ),
      ),
    );
  }
  return $events;
}