Skip to content

Instantly share code, notes, and snippets.

@k4ml
Created November 29, 2010 05:42
Show Gist options
  • Save k4ml/719621 to your computer and use it in GitHub Desktop.
Save k4ml/719621 to your computer and use it in GitHub Desktop.
<?php
function modulename_theme($existing, $type, $theme, $path) {
return array(
'formtemplate_horizontal' => array(
'arguments' => array('form' => NULL),
),
);
}
function theme_formtemplate_horizontal($form) {
$output = '<table class="formtemplate-horizontal"><tr>';
foreach (element_children($form) as $key) {
if (in_array($form[$key]['#type'], array('submit', 'button'))) {
$output .= '<td class="valign-middle">';
}
else {
$output .= '<td>';
}
$output .= drupal_render($form[$key]) .'</td>';
}
$output .= '</tr></table>';
return $output;
}
/*
css
table.formtemplate-horizontal {
width: 0;
border-collapse: none;
}
table.formtemplate-horizontal .valign-middle {
vertical-align: middle;
}
*/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment