function uc_addresses_form_uc_order_address_book_form_alter in Ubercart Addresses 6.2
Same name and namespace in other branches
- 7 uc_addresses.module \uc_addresses_form_uc_order_address_book_form_alter()
Implementation of 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 1179 - Adds user profile address support to Ubercart.
Code
function uc_addresses_form_uc_order_address_book_form_alter(&$form, &$form_state) {
$uid = $form_state['post']['uid'];
$type = $form_state['post']['type'];
$select = uc_addresses_select_address($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');",
),
);
}