Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function MODULE_NAME_form_profile2_edit_YOUR_PROFILE_TYPE_form_alter(&$form, &$form_state) {
- // Apply transformations to $form
- // e.g. change field weights
- $form['your_custom_profile_type']['place_of_work']['#weight'] = '-10';
- // e.g. copy field into new position
- $form['account']['place_of_work'] = $form['your_custom_profile_type']['place_of_work'];
- // Add a custom pre_render function to prevent the field from showing up again in the form
- $form['#pre_render'][] = 'MODULE_NAME_pre_render';
- }
- function MODULE_NAME_pre_render(&$form) {
- // Prevent custom field from displaying twice
- unset($form['your_custom_profile_type']['place_of_work']);
- return $form;
- }
Add Comment
Please, Sign In to add comment