簡體   English   中英

Drupal 7-將節點編輯表單添加到“簡單頁面”中

[英]Drupal 7 - Add node edit form into a 'Simple page'

我正在嘗試將現有節點的編輯表單添加到“基本”頁面。 根據給定的nid

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

$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).

我已經在這個問題上待了好幾個小時了,非常感謝您的幫助。

試試這個代碼:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM