You are here

function content_profile_registration_alter_weights in Content Profile 6

Pre render callback that makes sure our elements are grouped together. The ordering in between the single elements is kept.

See also

content_profile_registration_add_profile_form().

1 string reference to 'content_profile_registration_alter_weights'
content_profile_registration_add_profile_form in modules/content_profile_registration.module
Adds in the profile form of the given content type to the registration form

File

modules/content_profile_registration.module, line 188
Allows exposure and processing of content_profile node fields at user registration

Code

function content_profile_registration_alter_weights($elements) {
  foreach ($elements['#content_profile_weights'] as $key => $weight) {
    if (isset($elements[$key]) && is_array($elements[$key])) {
      $elements[$key] += array(
        '#weight' => 0,
      );
      $elements[$key]['#weight'] = $weight + $elements[$key]['#weight'] / 1000;
    }
  }
  return $elements;
}