hello..

can anybody help me with the code to theme a form created by using form api code...

Comments

imranweb’s picture

Hi,

You can do it using custom module.

/**
 * 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']);

saleempbt5’s picture

its really awesome!!!!!
thank you sir..