hello..
can anybody help me with the code to theme a form created by using form api code...
Hi,
You can do it using custom module.
<?php/** * Implements hook_theme(). */function YOURMODULE_theme() { return array( 'form_name' => array( 'arguments' => array('form' => NULL), 'template' => 'form-name', // your template path 'render element' => 'form', ), );}/** * @param $form * @param $form_state */function your_form($form, &$form_state) { // your form element definition $form['#theme'] = 'filter_form'; return $form;}// in template file 'filter-form.tpl.php':print drupal_render($form['form_element']);?>
its really awesome!!!!! thank you sir..
Comments
Hi,You can do it using
Hi,
You can do it using custom module.
<?php
/**
* Implements hook_theme().
*/
function YOURMODULE_theme() {
return array(
'form_name' => array(
'arguments' => array('form' => NULL),
'template' => 'form-name', // your template path
'render element' => 'form',
),
);
}
/**
* @param $form
* @param $form_state
*/
function your_form($form, &$form_state) {
// your form element definition
$form['#theme'] = 'filter_form';
return $form;
}
// in template file 'filter-form.tpl.php':
print drupal_render($form['form_element']);
?>
Thnks
its really awesome!!!!!
thank you sir..