I am using field_attach_form() to display an entity's form. When I call this function, it automatically builds the form, which does not contain any fieldsets, just ungrouped form elements.
Before the form is displayed I would like to take some of the form elements and group them into fieldsets. If I have something like this:
$form array:
form element 1
attributes
form element 2
attributes
fieldset1
attributes
fieldset2
attributes
Is there a form element attribute or special function that will allow me to tell Drupal to automatically place "form element 1" into "fieldset1"?
Alternatively, can this be done at the core/entity level, not the custom module, so that when field_attach_form() is called the fieldsets are automatically created?