You are here

function commerce_discount_rules_action_info in Commerce Discount 7

Implements hook_rules_action_info().

File

./commerce_discount.rules.inc, line 327
Rules integration for the Commerce Discount module.

Code

function commerce_discount_rules_action_info() {
  $types = commerce_discount_offer_types();
  $items = array();
  foreach ($types as $info) {
    $items[$info['action']] = array(
      'label' => $info['label'],
      'parameter' => array(
        'entity' => array(
          'label' => t('Entity'),
          'type' => 'entity',
          'wrapped' => TRUE,
        ),
        'commerce_discount' => array(
          'label' => t('Commerce Discount'),
          'type' => 'token',
          'options list' => 'commerce_discount_entity_list',
        ),
      ),
      'group' => t('Commerce Discount'),
      'base' => $info['action'],
    );
  }
  $items['commerce_discount_remove_discount_components_on_products'] = array(
    'label' => t('Remove discount price components'),
    'group' => t('Commerce Discount'),
    'parameter' => array(
      'commerce_line_item' => array(
        'type' => 'commerce_line_item',
        'label' => t('Line item'),
        'wrapped' => TRUE,
      ),
    ),
  );
  $items['commerce_discount_shipping_service'] = array(
    'label' => t('Apply shipping discount'),
    'group' => t('Commerce Discount'),
    'parameter' => array(
      'entity' => array(
        'label' => t('Entity'),
        'type' => 'entity',
        'wrapped' => TRUE,
      ),
      'commerce_discount' => array(
        'label' => t('Commerce Discount'),
        'type' => 'token',
        'options list' => 'commerce_discount_entity_list',
      ),
    ),
    'base' => 'commerce_discount_shipping_service',
  );
  $items['commerce_discount_shipping_services'] = array(
    'label' => t('Discount shipping services'),
    'parameter' => array(
      'commerce_order' => array(
        'type' => 'commerce_order',
        'label' => t('Order'),
      ),
    ),
    'group' => t('Commerce Discount'),
  );
  return $items;
}