function uc_addresses_get_address_form_submit in Ubercart Addresses 6.2
Same name and namespace in other branches
- 5.2 uc_addresses.module \uc_addresses_get_address_form_submit()
- 5 uc_addresses.module \uc_addresses_get_address_form_submit()
- 6 uc_addresses.module \uc_addresses_get_address_form_submit()
- 7 uc_addresses.pages.inc \uc_addresses_get_address_form_submit()
Submit handler for the address form.
Return value
void
See also
uc_addresses_get_address_form()
uc_addresses_get_address_form_validate()
File
- ./
uc_addresses.pages.inc, line 413 - Page callbacks for viewing, adding, editing, and deleting addresses.
Code
function uc_addresses_get_address_form_submit(&$form, &$form_state) {
try {
$address = $form['uc_addresses']['address']['#uc_addresses_address'];
if ($form_state['clicked_button']['#value'] == variable_get('uc_addresses_delete_button', t('Delete address'))) {
unset($form_state['storage']);
// Storage must be cleared or else the redirect does not work.
$form_state['redirect'] = 'user/' . $address
->getUserId() . '/addresses/' . $address
->getId() . '/delete';
}
elseif ($form_state['clicked_button']['#value']) {
$address
->save();
drupal_set_message(t('The address is saved.'));
unset($form_state['storage']);
// Storage must be cleared or else the redirect does not work.
$form_state['redirect'] = 'user/' . $address
->getUserId() . '/addresses';
}
} catch (Exception $e) {
drupal_set_message($e
->getMessage(), 'error');
}
}