Templating a Drupal Form

I was attempting to customize the look of a form that I create in a module using Drupal. I wanted to add images to a check box form element. This was a very useful link that explained how to call the form via the form id in the template.php file which then allows you to create a form.tpl.php file for custom styling.
http://drupal.org/node/62888#comment-119263

Great find

This is a great link! I remember when Dave and I were trying to figure out how to do this when we started The Vineyard Voice and ended up doing almost this. We went about it a slightly different way, instantiating the function only when the args were right. In this way we could have separate tpl files for the 'add' and the 'edit' forms. Here's a piece of what I mean:


/**
* VIDEO ADD
*/
if ((arg(0) == 'node') && (arg(1) == 'add') && (arg(2) == 'video')) {
function phptemplate_node_form($form) {
return _phptemplate_callback('video_add', array('user' => $user, 'form' => $form));
}
}


/**
* VIDEO EDIT
*/
if ((arg(0) == 'node') && (arg(2) == 'edit')) {
$node = node_load(array('nid' => arg(1)));
if ($node->type == 'video') {
function phptemplate_node_form($form) {
return _phptemplate_callback('video_edit', array('form' => $form));
}
}
}

The technique in the link you sent is much cleaner and our code could be improved upon quite a bit.