Guest User

Untitled

a guest
Dec 16th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. function MODULE_NAME_form_profile2_edit_YOUR_PROFILE_TYPE_form_alter(&$form, &$form_state) {
  2. // Apply transformations to $form
  3. // e.g. change field weights
  4. $form['your_custom_profile_type']['place_of_work']['#weight'] = '-10';
  5.  
  6. // e.g. copy field into new position
  7. $form['account']['place_of_work'] = $form['your_custom_profile_type']['place_of_work'];
  8.  
  9. // Add a custom pre_render function to prevent the field from showing up again in the form
  10. $form['#pre_render'][] = 'MODULE_NAME_pre_render';
  11. }
  12.  
  13. function MODULE_NAME_pre_render(&$form) {
  14. // Prevent custom field from displaying twice
  15. unset($form['your_custom_profile_type']['place_of_work']);
  16. return $form;
  17. }
Add Comment
Please, Sign In to add comment