You are here

function uc_coupon_data_property_get in Ubercart Discount Coupons 7.3

Generic getter to extract properties from the coupon data array.

1 string reference to 'uc_coupon_data_property_get'
UcCouponMetadataController::entityPropertyInfo in ./uc_coupon.entity.inc

File

./uc_coupon.entity.inc, line 270
Entity Controller and Metadata Controller classes for uc_coupon.

Code

function uc_coupon_data_property_get($coupon, array $options, $name, $entity_type) {
  switch ($name) {
    case 'base_coupon':
      return empty($coupon->data['base_cid']) ? FALSE : uc_coupon_load($coupon->data['base_cid']);
      break;
    default:
      if (!isset($coupon->data[$name])) {
        return NULL;
      }
      elseif (is_array($coupon->data[$name])) {
        return array_values($coupon->data[$name]);
      }
      else {
        return $coupon->data[$name];
      }
  }
}