Take the 2-minute tour ×

i am writing a drupal module. in my module i have the following:

in my .module file i have:

function mymodule_managment_menu(){
$items = array();
$items['management/edit'] = array(
    'title' => 'Add Node',
    'page callback' => 'display_add',
    'access callback' => 'user_access',
    'file' => 'file.inc',
  return $items;

in my file.inc i have:

function uc_am_display_edit()
  global $user;
  $node = array('uid' => $user->uid, 'name' => (isset($user->name) ? $user->name : ''), 'type' => 'track', 'language' => '');
  $output = drupal_get_form('track_node_form', $node);
  return $output;

when i go to http://myhost/management/edit i get the following warnning message:

warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'node_form' not found or invalid function name in /var/www/includes/form.inc on line 378.

when debugging i get to form.inc:378 which is:

  $form = call_user_func_array(isset($callback) ? $callback : $form_id, $args);

where my $callback = 'node_form'. but still it is not defined. of course, when i go to http://myhost/node/add/track i get the properly designed form i want. when i debug it, i go throw thte same path of code, with the same variables value, and node_form is declared. so my guess here is that my module is loaded before the node module, but just writing that makes doubt it, since the node module is a core module. tried to increase my module weight value to 11 - didnt help. please help...

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The function node_form is defined in modules/node/node.pages.inc. That file is not loaded by default. You have to load it manually using module_load_include in your page callback.

share|improve this answer
thanks a lot. worked like a charm. –  Oded Jan 22 '11 at 21:47
add comment

Your Answer


