Drupal 7: Render Drupal system forms in custom module[drupal_get_form()]

The function drupal_get_form() is used to get the form details. Normally in Drupa,l the form field are constructed as an associative array. This associative array is defined inside a form function. The function name is the form ID, using this form ID we can able to render the form.

The below is the example and implementation of drupal_get_form().


$formArray = drupal_get_form(FORM_NAME);
print drupal_render($formArray);


$formArray = drupal_get_form('search_form');
$formData = drupal_render($formArray);
print $formData;