? theming.patch Index: uc_extra_fields_pane.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/uc_extra_fields_pane/uc_extra_fields_pane.module,v retrieving revision 1.1.2.3 diff -u -p -r1.1.2.3 uc_extra_fields_pane.module --- uc_extra_fields_pane.module 14 Apr 2010 09:38:29 -0000 1.1.2.3 +++ uc_extra_fields_pane.module 7 May 2010 08:24:57 -0000 @@ -353,7 +353,7 @@ function uc_extra_fields_pane_billing($o } } - return array('description' => $description, 'contents' => $contents); + return array('description' => $description, 'contents' => $contents, 'theme' => 'uc_extra_fields_pane'); case 'process': // initialize and fill array if ($arg1->extra_fields==NULL) $arg1->extra_fields=array(); @@ -396,7 +396,7 @@ function uc_extra_fields_pane_delivery($ } } - return array('description' => $description, 'contents' => $contents); + return array('description' => $description, 'contents' => $contents, 'theme' => 'uc_extra_fields_pane'); case 'process': // initialize and fill array if ($arg1->extra_fields==NULL) $arg1->extra_fields=array(); @@ -634,3 +634,48 @@ function uc_extra_fields_pane_token_list } return $tokens; } + +/* + * THEMING + */ + +/** + * Implementation of hook_theme(). + */ +function uc_extra_fields_pane_theme() { + return array( + 'uc_extra_fields_pane' => array( + 'arguments' => array('form' => NULL), + ), + ); +} + +/** + * Theme the extra fields delivery/billing forms in tables. + * + * @ingroup themeable + * @see + * uc_extra_fields_pane_delivery() + * uc_extra_fields_pane_billing() + */ +function theme_uc_extra_fields_pane($form) { + $req = '*'; + $output = '
'; + + foreach (element_children($form['extra_fields']) as $field) { + $title = $form['extra_fields'][$field]['#title'] .':'; + unset($form['extra_fields'][$field]['#title']); + $output .= ''; + } + $output .= '
'; + if ($form['extra_fields'][$field]['#required']) { + $output .= $req; + } + $output .= $title .''. drupal_render($form['extra_fields'][$field]) .'
'; + + foreach (element_children($form) as $element) { + $output .= drupal_render($form[$element]); + } + + return $output; +}