You are here

function commerce_shipping_rules_event_info in Commerce Shipping 7.2

Same name and namespace in other branches
  1. 7 commerce_shipping.rules.inc \commerce_shipping_rules_event_info()

Implements hook_rules_event_info().

File

./commerce_shipping.rules.inc, line 15
Rules integration for shipping.

Code

function commerce_shipping_rules_event_info() {
  $events = array();
  $events['commerce_shipping_collect_rates'] = array(
    'label' => t('Collecting shipping rates for an order'),
    'group' => t('Commerce Shipping'),
    'variables' => array(
      'commerce_order' => array(
        'label' => t('Order', array(), array(
          'context' => 'a drupal commerce order',
        )),
        'type' => 'commerce_order',
        'skip save' => TRUE,
      ),
    ),
    'access callback' => 'commerce_order_rules_access',
  );

  // Include the Line Item module's Rules integration to reuse
  // its access callback.
  module_load_include('inc', 'commerce_line_item', 'commerce_line_item.rules');
  $events['commerce_shipping_calculate_rate'] = array(
    'label' => t('Calculating a shipping rate'),
    'group' => t('Commerce Shipping'),
    'variables' => array(
      'commerce_line_item' => array(
        'label' => t('Shipping line item'),
        'type' => 'commerce_line_item',
        'skip save' => TRUE,
      ),
    ),
    'access callback' => 'commerce_line_item_rules_access',
  );
  return $events;
}