Maybe we can start a thread about the best practices to use when theming forms for Drupal 7. Seemed a few things have changed since drupal 6. BEFORE, in Drupal 6 I would simply use the following in template.php:

<?php
function mytheme_theme(&$existing, $type, $theme, $path) {
  $hooks = omega_theme($existing, $type, $theme, $path);
  // Add your theme hooks like this:
  /*
  $hooks['hook_name_here'] = array( // Details go here );
  */

  $hooks['places_node_form'] = array(
	  'template' => 'node-places-edit',
	  'arguments' => array('form' => NULL),
	);

  // @TODO: Needs detailed comments. Patches welcome!
  return $hooks;
}

?>

Then I would create a node-places-edit.tpl.php template and spit out cck fields manually like this:

<table class="edit-location">
<tr><td class="label">Useful directions:</td><td class="form-field"><?php print drupal_render($form['field_place_directions']); ?></td></tr>
<tr><td class="label">Phone:</td><td class="form-field"><?php print drupal_render($form['field_place_phone']); ?></td></tr>
<tr><td class="label">Website:</td><td class="form-field"><?php print drupal_render($form['field_place_website']); ?></td></tr>
<tr><td class="label">Hours of operation:</td><td class="form-field"><?php print drupal_render($form['field_place_hours']); ?></td></tr>
<tr><td class="label">Description:</td><td class="form-field"><?php print drupal_render($form['field_place_description']); ?></td></tr>
<tr><td class="label">Photos:</td><td class="form-field"><?php print drupal_render($form['field_place_photos']); ?></td></tr>
</table>

<?php 
//print dsm($form);
print drupal_render($form);
?>

** A few things have changed in Drupal 7 and I though we can start a discussion on the best practices for theming forms using the Omega framework. ***

Comments

garciac1212’s picture

It seems for Drupal 7 it might be similar. In template.php the following would be:

<?php
function mytheme_theme($existing, $type, $theme, $path) {
    return array(
        'location_node_form' => array(
            'arguments' => array('form' => NULL),
            'template' => 'templates/node--add--location',
            'render element' => 'form',
            ),
    );
}
?>

Then you would create a "node--add--location.tpl.php" and put the variables in there. I'm still a little confused on how to print out the dsm($form) in the template file to see all form variables. Any guidance would be greatly appreciated ....