[support] Showing a node edit page with drupal_get_form() and hook_menu()

Christian chrisboo at web.de
Wed Jul 25 17:58:51 UTC 2012


Hello everybody,
I am new to drupal and am stuck at a very basic problem. I would like to 
simply show the edit page to a known node id. (The reason I want to do 
this is because I would like to append a form to a view late, but one 
step at a time...)

My module:

<?php
/*
  * Show the edid page to a specific nid.
  */

function control_center_menu() {
   $items = array();
   module_load_include('inc', 'node', 'node.pages');
   $nid = 4;
   $node = node_load($nid);
   $items['test/test'] = array(
     'title' => 'Edit this node',
     'description' => 'Edit this node.',
     'page callback' => 'drupal_get_form',
     'page arguments' => array('page_node_form', $node),
     'access callback' => TRUE,
   );
   return $items;
}


However, at test/test I get a bunch of errors:

  * /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 /795/ of
    //home/christian/workspace/gigs/includes/form.inc/).
  * /Notice/: Undefined index: #node in /menu_form_node_form_alter()/
    (line /629/ of
    //home/christian/workspace/gigs/modules/menu/menu.module/).
  * /Notice/: Trying to get property of non-object in
    /menu_form_node_form_alter()/ (line /629/ of
    //home/christian/workspace/gigs/modules/menu/menu.module/).
  * /Notice/: Undefined index: #node in /menu_form_node_form_alter()/
    (line /630/ of
    //home/christian/workspace/gigs/modules/menu/menu.module/).
  * /Notice/: Trying to get property of non-object in
    /menu_form_node_form_alter()/ (line /630/ of
    //home/christian/workspace/gigs/modules/menu/menu.module/).

And instead of the hole form I only get the Menu setting check box and 
the URL path settings.


What am I doing wrong? I tried hard to find a noob friendly copy past 
example but didn't find any... Thanks a lot in advance!

Christian


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20120725/3617d0f2/attachment.html 


More information about the support mailing list