How to create template file for form in drupal

    To create template file for form in drupal you can use hook_theme() For Example: Create a custom module i have created a module name custom_profile so hook is replaced by custom_profile
    <?php
    /**
    * Implementation of hook_theme()
    */
    function custom_profile_theme() {
      return array(
       
    'custom_profile_publications' => array(
         
    'arguments' => array('form' => NULL),
         
    'template' => 'create-publication',
        ),
      );
    }
    // Where custom_profile_publications is form id
    // arguments form is the argument passes to the tpl file
    // create-publication is the tpl file created inside the module tpl file named as create-publication.tpl.php
    // user $form and drupal_render() in the template file
    ?>
    5
    Average: 5 (1 vote)