Drupal 7 how to apply custom template to my custom form -
i have module, includes multistep form. decided make 1 of these steps work this: free times per employee rendered html elements, , when element clicked, javascript apply value hidden input field.
so found tutorial: http://drupal.org/node/1092122 didn't work me, maybe made error, maybe not.
my module name reservation. template file named reservation_select_time_week_page.tpl.php , in reservation/theme folder.
i have these functions:
function reservation_theme() { // basic things $module_path = drupal_get_path('module', 'reservation'); $base = array( 'path' => "$module_path/theme", ); // define themes return array( 'reservation_select_time_form' => $base + array( 'render element' => 'form', 'template' => 'reservation_select_time_week_page', ), ); } function template_preprocess_reservation_select_time_week_page(&$variables) { echo "this works!"; } function template_preprocess_select_time_form(&$variables) { echo "this works!"; }
i dont know of preprocess functions right (should named based on template name or form id?
anyhow, custom template not applying.
i have tried using the:
$form['start_time'] => array('#theme' => 'reservation_select_time_week_page');
i got working, static html rendered in template file, dont know how can render form elements in template file. using:
drupal_render($form)
caused form go infinite loop think.
is drupal able handle complex forms , form layouts?
Comments
Post a Comment