drupal_get_form : Manual call to render a form isn't working
Menu Callback
function content_form_select($id, $sid){
$type = check_content_type($sid);
if($type == 'video')
// Render content edit form
return drupal_get_form('content_video_form', $id, $sid);
else if($type == 'gallery')
// Render content edit form
return drupal_get_form('content_gallery_form', $id, $sid)开发者_JAVA百科;
}
Video Form Generator
function content_video_form($id=null, $sid=null){
return array('#value' => 'Video form is getting rendered.');
}
Gallery Form Generator
function content_gallery_form($id=null, $sid=null){
return array('#value' => 'Gallery form is getting rendered.');
}
It does not render form this way
The drupal_get_form expects to receive a $form array, which then contains the form elements. Using one of your example functions above, the following change works for me:
function content_gallery_form($id=null, $sid=null){
$form['example'] = array('#value' => 'Gallery form is getting rendered.');
return $form;
}
精彩评论