我尝试将现有节点的编辑表单添加到Basic页面。基于给定的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).
我已经在这个问题上待了好几个小时,非常感谢任何帮助。
答案 0 :(得分: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);