You are here

function commerce_cart_rules_event_variables in Commerce Core 7

Returns a variables array for shopping cart events.

Parameters

$line_item: Boolean indicating whether or not to include product line item variables.

1 call to commerce_cart_rules_event_variables()
commerce_cart_rules_event_info in modules/cart/commerce_cart.rules.inc
Implements hook_rules_event_info().

File

modules/cart/commerce_cart.rules.inc, line 47
Rules integration for shopping carts.

Code

function commerce_cart_rules_event_variables($line_item = FALSE) {
  $variables = array(
    'commerce_order' => array(
      'type' => 'commerce_order',
      'label' => t('Shopping cart order'),
    ),
    'commerce_product' => array(
      'label' => t('Product'),
      'type' => 'commerce_product',
    ),
    'quantity' => array(
      'label' => t('Quantity'),
      'type' => 'integer',
    ),
  );
  if ($line_item) {
    $variables += array(
      'commerce_line_item' => array(
        'label' => t('Product line item'),
        'type' => 'commerce_line_item',
      ),
      'commerce_line_item_unchanged' => array(
        'label' => t('Unchanged product line item'),
        'type' => 'commerce_line_item',
        'skip save' => TRUE,
        'handler' => 'rules_events_entity_unchanged',
      ),
    );
  }
  return $variables;
}