You are here

function commerce_coupon_reference_field in Commerce Coupon 7

2 calls to commerce_coupon_reference_field()
commerce_coupon_line_item_configuration in ./commerce_coupon.module
Ensures the coupon line item type contains a coupon reference field.
commerce_coupon_order_configuration in ./commerce_coupon.module
Ensures the coupon reference field is present on the default order bundle.

File

./commerce_coupon.module, line 1044
Coupon System for Drupal Commerce.

Code

function commerce_coupon_reference_field($field_name, $cardinality) {
  $field = array(
    'field_name' => $field_name,
    'type' => 'entityreference',
    'cardinality' => $cardinality,
    'entity_types' => array(
      'commerce_order',
      'commerce_line_item',
    ),
    'module' => 'entityreference',
    'translatable' => FALSE,
    'settings' => array(
      'target_type' => 'commerce_coupon',
      'handler' => 'coupon',
      'handler_settings' => array(),
    ),
  );
  return $field;
}