Last active
December 19, 2015 04:59
-
-
Save killua99/5901069 to your computer and use it in GitHub Desktop.
two form in one page drupal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Implements hook_menu(). | |
*/ | |
function custom_two_form_menu() { | |
$items = array(); | |
$items['custom'] = array( | |
'title' => 'Custom', | |
'description' => 'Two forms one page', | |
'page callback' => 'custom_two_form', | |
'access arguments' => array('access content'), | |
); | |
return $items; | |
} | |
/** | |
* View form. | |
*/ | |
function custom_two_form() { | |
$output = ''; | |
$form_one = drupal_get_form('first_form'); | |
$output .= drupal_render($form_one); | |
$form_two = drupal_get_form('second_form'); | |
$output .= drupal_render($form_two); | |
return $output; | |
} | |
/** | |
* First form. | |
*/ | |
function first_form($form, &$form_state) { | |
$form = array(); | |
... | |
return $form; | |
} | |
/** | |
* Second form. | |
*/ | |
function second_form($form, &$form_state) { | |
$form = array(); | |
... | |
return $form; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment