I want to control the rendering of some input-type elements on a form generated by my module. Specifically, I want to separate the LABEL and INPUT elements into individual table cells.
I think the correct approach is to set the elements' '#theme' to a custom implementation of theme_form_element(), which is what I tried to do.
But drupal_render() makes what I'm trying to achieve impossible, because (for some reason I can't fathom) when drupal_render sees that an element's '#theme' is set, it does this:
$elements['#type'] = 'markup';
and so my theme function can't tell whether the element is supposed to be a checkbox, textfield, etc.
I can think of some kludgy workarounds, but I'm thinking I must be missing something here, most likely a completely different and better way to go at this.
What am I missing here? Why would drupal_render unset the '#type' field? What's the right way to do what I'm trying to do?
Thanks!