You are here

function _uc_coupon_purchase_create_recipient_attribute in Ubercart Discount Coupons 7.3

Helper function to create the product attribute specifying gift certificate recipients. Will only create the attribute if it does not already exist.

Return value

The recipient attribute.

1 call to _uc_coupon_purchase_create_recipient_attribute()
uc_coupon_purchase_coupon_settings_form_submit in uc_coupon_purchase/uc_coupon_purchase.module
Submit handler for uc_coupon_settings_form.

File

uc_coupon_purchase/uc_coupon_purchase.module, line 443

Code

function _uc_coupon_purchase_create_recipient_attribute() {
  if (!($attribute = _uc_coupon_purchase_load_recipient_attribute())) {
    $attribute = array(
      'name' => UC_COUPON_PURCHASE_RECIPIENT_ATTRIBUTE,
      'label' => t('Gift Certificate Recipient'),
      'description' => t('The e-mail address of the recipient of this gift certificate'),
      'required' => FALSE,
      'display' => 0,
      'ordering' => 0,
    );
    $attribute = (object) $attribute;
    uc_attribute_save($attribute);

    // Flush the cache.
    $attribute = _uc_coupon_purchase_load_recipient_attribute(TRUE);
  }
  return $attribute;
}