function customer_form($customer) {
$form = array();The form is build by the following function:-
$form['name'] = array('#type' => 'textfield',
'#default_value' => $customer->name,
'#title' => 'Nama');
$form['address'] = array('#type' => 'textarea',
'#default_value' => $customer->address,
'#size' => 30,
'#title' => 'Alamat');
$form['postcode'] = array('#type' => 'textfield',
'#title' => t('Poskod'),
'#size' => 5,
'#maxlength' => 5,
'#default_value' => $customer->postcode);
$form['city'] = array('#type' => 'textfield',
'#title' => t('Bandar'),
'#size' => 30,
'#default_value' => $customer->city);
}
function customer_new($customer) {So to override the default presentation, we define the theme function as `theme_form_id`:-
return drupal_get_form('customer_new', customer_form($customer));
}
function theme_customer_new($form) {References:- http://drupal.org/node/47582
$output = new Container;
$output->add(form_render($form['name']));
$table = html_table();
$table->add_row(form_render($form['address']), form_render($form['city']), form_render($form['postcode']));
$output->add($table);
// render the rest of the elements
$output->add(form_render($form));
return $output->render();
}
Notes:-
This example make use PHPHtmllib library to build the HTML table.