Very quickly, here's a useful tip if you're theming any kind of Drupal form. Just put the following in your overriding .tpl.php file
<?php print "<pre>"; print_r(array_values($form));print "</pre>"; ?>and it'll output a complete list of things you can theme.
Not ground breaking I know, but one of those things I can never seem to find when I want!




Hi, I'm Laurence and this is my Drupal blog.
Don't Make Me Think!
Using Drupal
PHP Cookbook
Pro Drupal Development, Second Edition
with the devel module (http://drupal.org/project/devel) enabled it can be even as easy as "dvm($form)"
Or if you want to take it further and get ALL variables available within any of your .tpl.php file:
<pre><?php print_r(get_defined_vars()); ?></pre>Thanks guys, excellent suggestions!
I use this:
<?phpdrupal_set_message('<pre>'.print_r(array_values($form),true).'</pre>');
?>
var_dump ;)
This is how I modify forms in Drupal 5 using phptemplate. I haven't needed to in 6 yet. Probably similar.
function zen_node_form($form){
//all node edit forms
$form['path']['path']['#description'] .= 'my custom additions';
//specific node types
switch($form['form_id']['#value'])
{
case "video_node_form":
return _phptemplate_callback('video_edit', array('form' => $form), array('video-edit'));
break;
default:
return drupal_render($form);
}
}
and video-edit.tpl.php (the template you registered in _phptempleat_callback()) contains:
$form['attachments']['#weight'] = -4;$form['field_screenshot']['#weight'] = -3;
$form['field_duration']['#weight'] = -2;
$form['attachments']['#title'] = "Video";
$form['attachments']['#collapsable'] = 1;
$form['attachments']['#collapsed'] = 0;
print drupal_render($form);