Skip to content

Instantly share code, notes, and snippets.

@jbubriski
Last active December 11, 2015 20:39
Show Gist options
  • Save jbubriski/4656989 to your computer and use it in GitHub Desktop.
Save jbubriski/4656989 to your computer and use it in GitHub Desktop.
Theming an admin form for the webforms module.
function theme_pardot_webform_components_form($form) {
$form = $form['form'];
$rows = array();
$output = '';
$header = array(t('Name'), t('Type'), t('Pardot key'));
foreach (element_children($form['components']) as $k) {
$row = array();
// Name
$row[] = $form['#node']->webform['components'][$k]['name'];
// Type
$row[] = $form['#node']->webform['components'][$k]['type'];
// Pardot key
unset($form['components'][$k]['key']['#title']);
$row[] = drupal_render($form['components'][$k]['key']);
$rows[] = $row;
}
$output .= drupal_render($form['details']);
$output .= theme('table', array('header' => $header, 'rows' => $rows));
$output .= drupal_render_children($form);
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment