Closed (fixed)
Project:
Profile 2
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
26 Apr 2018 at 02:05 UTC
Updated:
10 May 2018 at 19:54 UTC
Jump to comment: Most recent
I created a custom module with hook_form_alter to change the weight of the address fields (from the address field module). However, when you activate the module, the address field goes beyond the edit form, it only works if the profile2_page module is enabled in the profile. The problem is that I do not want to use profile2_page. Can someone help me?
Comments
Comment #2
rickj commentedI don't understand why you need custom code to change the weight. What can you not do using "Manage Fields" and "Manage Display" in the profile configuration?
Comment #3
wesleybpereira commentedIt's because the address field module does not allow changing the position of the fields by the manager. The only way I found it was by using a custom module with hook_form_alter.
Comment #4
rickj commentedAh, so you mean the ordering of the fields within the address field module itself? That's really an issue for the address field module, not very much to do with profile2.
The address field widget controls the layout of the whole address block. It's not trivial, because the fields shown, and their position, depends on the selected country. A lot of it is done by Javascript, and is largely the point of the module.
If I understand you right, then you need to be looking at address field. I use address field myself, but I haven't needed to do what you're suggesting.
Comment #5
wesleybpereira commentedRicky, I did it! I used "hook_form_profile2_edit_PROFILE_TYPE_form_alter ()" and it worked. I do not know if the way I did is the right one, but it worked. Thank you so much for everything! Hug!
This was the code I used in a custom module.
Comment #6
wesleybpereira commented