function commerce_customer_ui_form_commerce_customer_ui_customer_profile_form_alter in Commerce Core 7
Implements hook_form_FORM_ID_alter().
The Customer UI module instantiates the Profile add/edit form at particular paths in the Commerce IA. It uses its own form ID to do so and alters the form here to add in appropriate redirection and an additional button.
See also
commerce_customer_ui_customer_profile_form()
File
- modules/
customer/ commerce_customer_ui.module, line 295
Code
function commerce_customer_ui_form_commerce_customer_ui_customer_profile_form_alter(&$form, &$form_state) {
// Add a submit handler to the save button to add a redirect.
$form['actions']['submit']['#submit'][] = 'commerce_customer_ui_customer_profile_form_submit';
// Add the save and continue button for new profiles.
if (empty($form_state['customer_profile']->profile_id)) {
$form['actions']['save_continue'] = array(
'#type' => 'submit',
'#value' => t('Save and add another'),
'#submit' => $form['actions']['submit']['#submit'],
'#suffix' => l(t('Cancel'), 'admin/commerce/customer-profiles'),
'#weight' => 45,
);
}
else {
$form['actions']['submit']['#suffix'] = l(t('Cancel'), 'admin/commerce/customer-profiles');
}
}