0

メニューコールバック

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);
}

ビデオフォームジェネレータ

function content_video_form($id=null, $sid=null){
    return array('#value' => 'Video form is getting rendered.');
}

ギャラリーフォームジェネレータ

function content_gallery_form($id=null, $sid=null){
    return array('#value' => 'Gallery form is getting rendered.');
}

このようにフォームをレンダリングしません

4

1 に答える 1

1

drupal_get_formは、フォーム要素を含む$form配列を受け取ることを期待しています。上記の関数例の1つを使用すると、次の変更が機能します。

function content_gallery_form($id=null, $sid=null){
  $form['example'] = array('#value' => 'Gallery form is getting rendered.');
  return $form;
}
于 2011-01-27T04:12:10.830 に答える