You are here

function uc_addresses_form_uc_order_address_book_form_alter in Ubercart Addresses 7

Same name and namespace in other branches
  1. 6.2 uc_addresses.module \uc_addresses_form_uc_order_address_book_form_alter()

Implements hook_form_FORM_ID_alter() for form uc_order_address_book_form().

Makes sure selectable addresses at the order administration can come from the address book.

Return value

void

File

./uc_addresses.module, line 1642
Adds user profile address support to Ubercart.

Code

function uc_addresses_form_uc_order_address_book_form_alter(&$form, &$form_state) {
  $uid = $form_state['input']['uid'];
  $type = $form_state['input']['type'];
  $select = uc_addresses_select_addresses($uid, 'order_form', $type);
  if ($uid == 0) {
    $form['desc'] = array(
      '#value' => '<br />' . t('You must select a customer before address<br />information is available.<br />') . '<br />',
    );
  }
  elseif (is_null($select)) {
    $form['desc'] = array(
      '#value' => '<br />' . t('No addresses found for customer.') . '<br />',
    );
    $form['addresses']['#access'] = FALSE;
  }
  else {
    $form['addresses'] = $select;
    $form['desc']['#value'] = '';
  }
  $form['close'] = array(
    '#type' => 'button',
    '#value' => t('Close'),
    '#weight' => 50,
    '#attributes' => array(
      'onclick' => "return close_address_select('#" . $type . "_address_select');",
    ),
  );
}