drupal_get_form: ручной вызов для отображения формы не работает - PullRequest
0 голосов
/ 26 января 2011

Меню обратного вызова

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

Не отображает форму таким образом

1 Ответ

1 голос
/ 27 января 2011

drupal_get_form ожидает получить массив $ form, который затем содержит элементы формы. Используя одну из приведенных выше функций примера, у меня работает следующее изменение:

function content_gallery_form($id=null, $sid=null){
  $form['example'] = array('#value' => 'Gallery form is getting rendered.');
  return $form;
}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...