You are here

function commerce_coupon_get_properties in Commerce Coupon 7

Callback for getting coupon properties.

See also

commerce_coupon_entity_property_info()

1 string reference to 'commerce_coupon_get_properties'
commerce_coupon_entity_property_info in ./commerce_coupon.info.inc
Implements hook_entity_property_info() of entity module.

File

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

Code

function commerce_coupon_get_properties($coupon, array $options, $name) {
  switch ($name) {
    case 'price_component_name':
      $coupon_machine_name = commerce_coupon_machine_name_code($coupon);
      return $coupon->type . '_' . $coupon_machine_name;
      break;
    case 'times_used':
      return commerce_coupon_get_number_of_uses($coupon->coupon_id);
      break;
  }
}