You are here

function uc_coupon_purchase_form_uc_attribute_form_alter in Ubercart Discount Coupons 7.3

Implements hook_form_FORM_ID_alter() for uc_attribute_form.

File

uc_coupon_purchase/uc_coupon_purchase.module, line 485

Code

function uc_coupon_purchase_form_uc_attribute_form_alter(&$form, &$form_state) {

  // If our reserved attribute is being edited, prevent the name from being changed.
  if (!empty($form['aid']['#value']) && ($attribute = uc_attribute_load($form['aid']['#value'])) && $attribute->name === UC_COUPON_PURCHASE_RECIPIENT_ATTRIBUTE) {
    $form['name']['#disabled'] = TRUE;
    $form['name']['#description'] .= ' ' . t('This attribute is used by uc_coupon_purchase to send additional notifications to purchased coupon recipients. The name cannot be altered.');
  }
  $form['#validate'][] = 'uc_coupon_purchase_attribute_form_validate';
}