To show add node form in particular place I created a new block on the Block page with content:

<?php  
global $user;
module_load_include('inc', 'node', 'node.pages');
$node = (object) array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => 'foto', 'language' => LANGUAGE_NONE);
$form = drupal_get_form('foto_node_form',$node);
print drupal_render($form);
?>    

Then I go to my page with this block and try to add content within this block. When I fill only text fields or checkboxes everything is OK. But I receive a lot of errors when try to upload an image to image field.

•Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'node_form' was given in function drupal_retrieve_form() (line 800 in file D:\sites\mytheme\www\includes\form.inc).
•Notice: Undefined index: #node in function comment_form_node_form_alter() (line 1194 in fileD:\sites\mytheme\www\modules\comment\comment.module).
•Notice: Trying to get property of non-object in function comment_form_node_form_alter() (line 1211 in fileD:\sites\mytheme\www\modules\comment\comment.module).
•Notice: Undefined index: #node in function menu_form_node_form_alter() (line 629 in file D:\sites\mytheme\www\modules\menu\menu.module).
•Notice: Trying to get property of non-object in function menu_form_node_form_alter() (line 629 in fileD:\sites\mytheme\www\modules\menu\menu.module).
•Notice: Undefined index: #node in function menu_form_node_form_alter() (line 630 in file D:\sites\mytheme\www\modules\menu\menu.module).
•Notice: Trying to get property of non-object in function menu_form_node_form_alter() (line 630 in fileD:\sites\mytheme\www\modules\menu\menu.module).
•Notice: Undefined index: field_image in function file_ajax_upload() (line 271 in file D:\sites\mytheme\www\modules\file\file.module).
•Notice: Undefined index: #suffix in function file_ajax_upload() (line 280 in file D:\sites\mytheme\www\modules\file\file.module).    

What I'm doing wrong? Thanks in advance

share|improve this question
I think it's already [answered][1] here. [1]: stackoverflow.com/questions/5344754/… – Anil Sagar Sep 14 '12 at 11:21
yes, I saw it, but I cannot understand where to put 'file path' => drupal_get_path('module', 'node'), 'file' => 'node.pages.inc', ? – moto Sep 14 '12 at 11:53
should it be in module.info file? – moto Sep 14 '12 at 11:56

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.