2015-07-01 122 views
0

我試圖將現有節點的編輯表單添加到基本頁面。根據給定的nidDrupal 7 - 將節點編輯表單添加到「簡單頁面」

這個問題似乎簡單,但我嘗試導致以下錯誤報告:

$node = node_load(array('nid' => 83)); 
$output = drupal_get_form($node->type .'_node_form', $node); 
echo $output; 

Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 175 of /home/PAE/www/paemanu/includes/entity.inc). 
Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->cacheGet() (line 388 of /home/PAE/www/paemanu/includes/entity.inc). 
Notice: Trying to get property of non-object in eval() (line 3 of /home/PAE/www/paemanu/modules/php/php.module(80) : eval()'d code). 
Notice: Undefined index: _node_form in drupal_retrieve_form() (line 806 of /home/PAE/www/paemanu/includes/form.inc). 
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function '_node_form' not found or invalid function name in drupal_retrieve_form() (line 841 of /home/PAE/www/paemanu/includes/form.inc). 
Notice: Undefined variable: output in eval() (line 3 of /home/PAE/www/paemanu/modules/php/php.module(80) : eval()'d code). 
Notice: Undefined index: user-project in drupal_retrieve_form() (line 806 of /home/PAE/www/paemanu/includes/form.inc). 
Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'user-project' not found or invalid function name in drupal_retrieve_form() (line 841 of /home/PAE/www/paemanu/includes/form.inc). 

我已經在這個問題上幾個小時,任何幫助是極大的讚賞。

+1

檢查這個環節出http://stackoverflow.com/questions/5344754/drupal-7-how-to-display-node-add-sometype-form-on-另一頁使用第一個答案 –

回答

1

試試這個代碼:

$nid = 83; 
$node = node_load($nid); 
$type = $node->type; 
module_load_include('inc', 'node', 'node.pages'); 
$form = drupal_get_form('node_edit_'.$type, $node); 
render($form); 
相關問題