Add same form multiple times on page Drupal 7


Show same form multiple times on page

To display custom form multiple times on same page you need to use hook_forms . Below example

  $form = drupal_get_form("workflow_tab_form_$node->nid", $node, $workflow->wid, $states, $current);  
 /**  
  * Implements hook_forms().  
  *  
  * Allows the workflow tab form to be repeated multiple times on a page.  
  * See http://drupal.org/node/1970846.  
  */  
 function workflow_forms($form_id, $args) {  
  $forms = array();  
  if (substr($form_id, 0, 18) == 'workflow_tab_form_') {  
   $forms[$form_id] = array('callback' => 'workflow_tab_form');  
  }  
  return $forms;  
 }  

Or you can refer https://api.drupal.org/api/drupal/modules%21system%21system.api.php/function/hook_forms/7 

Comments

Popular Posts