There are two approaches that have failed:
In the theme, add a theme hook for the node edit form. Then, create a template file for the node edit form. This won't work for my case, because the form is rendered in the template file with drupal_render_children, and therefore the contents of the form are not reachable within the template file--I need to add the divs in between the form elements.
Use hook_form_alter. This won't work for my case, because you have to target a specific form item. The users may, for example, add a new node field after I hand it off to them, and my existing hook_form_alter wouldn't have a way to catch it.
What I want to do is simple; in between every element on the node edit form, insert a <div class="clearfix"></div>
to separate them.
Or, I could add the "clearfix" class to the existing div containers around the form elements.
Do we have a solution for either method?
[EDIT] Here is the solution using hook_form_alter():
<?php
/**
* Implements hook_form_alter()
*/
function mytheme_form_alter(&$form, &$form_state, $form_id) {
if (preg_match('/node_form$/', $form_id)) {
$language = $form['language']['#value'];
foreach ($form_state['field'] as $field => $field_contents) {
$form[$field][$language]['#suffix'] = '<div class="clearfix></div>';
}
}
}
?>