I would like to disable some form elements within a Profile2 form in Drupal 7 (ie still visible but not editable). I figured using hook_form_alter would be the way to go but I can't figure out where I need to set the ['disabled'] field to true.
Here is the code that I have:
$fields = field_info_instances('profile2', 'student')
if ($fields) {
foreach($fields as $field) {
$field['#disabled'] = true; <- don't know what attribute to set here
}
}
In Drupal 6 this seemed pretty straight forward but using dsm($field) is not helping me determine what field attributes need to be set. I have Googled this and looked at the Drupal 7 API and I am still lost.
I am hoping someone can help me out here.
Thanks.