You are here

function profile2_form_validate_handler in Profile 2 7.2

Same name and namespace in other branches
  1. 7 profile2.module \profile2_form_validate_handler()

Validation handler for the profile form.

See also

profile2_attach_form()

1 string reference to 'profile2_form_validate_handler'
profile2_attach_form in ./profile2.module
Attaches the profile forms of the profiles set in $form_state['profiles'].

File

./profile2.module, line 789
Support for configurable user profiles.

Code

function profile2_form_validate_handler(&$form, &$form_state) {
  foreach ($form_state['profiles'] as $type => $profile) {
    if (isset($form_state['values']['profile_' . $profile->type])) {

      // @see entity_form_field_validate()
      $pseudo_entity = (object) $form_state['values']['profile_' . $profile->type];
      $pseudo_entity->type = $type;
      field_attach_form_validate('profile2', $pseudo_entity, $form['profile_' . $profile->type], $form_state);
    }
  }
}