function rh_profile2_profile2_form_submit in Rabbit Hole 7.2
Custom submit function for the Profile edit form.
_state
Parameters
$form:
1 string reference to 'rh_profile2_profile2_form_submit'
- rh_profile2_form_profile2_form_alter in modules/
rh_profile2/ rh_profile2.module - Implements hook_form_FORM_ID_alter().
File
- modules/
rh_profile2/ rh_profile2.module, line 123 - Main module file for Rabbit Hole Profile2 module.
Code
function rh_profile2_profile2_form_submit($form, &$form_state) {
// Get the action. Either the one specified for this Profile, or the default
// value for the bundle.
$action = isset($form_state['values']['rh_action']) && $form_state['values']['rh_action'] != RABBIT_HOLE_USE_DEFAULT ? $form_state['values']['rh_action'] : rabbit_hole_get_action_bundle('profile2', $form_state['profile2']->type);
// If the action says anything else than to display the content, make sure
// that the user doesn't land on the Profile view page. We'll check if a custom
// redirect path has been set, otherwise, we'll redirect the user to the edit
// page again.
if ($action != RABBIT_HOLE_DISPLAY_CONTENT && $form_state['redirect'] == $form_state['profile2']
->path()) {
$form_state['redirect'] = $form_state['profile2']
->path() . '/edit';
}
}