I didn't manage to get the clone.module updated for Drupal6.
While everything seemed to be straightforward, I couldn't get rid of the following warning:

warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'node_form' was given in /var/www/vhosts/mobilitaet.org/httpdocs/includes/form.inc on line 340.

The editing form doesn't show up.

The relevant code is:

function clone_menu() {
  $items['node/%node/clone'] = array(
    'page callback' => 'clone_node',
    'page arguments' => array(1),
    'title' => 'Clone',
    'type' => MENU_LOCAL_TASK,
  ); 
  return $items;
}

function clone_node($node) {
  return drupal_get_form($node->type .'_node_form', $node);
}

Do you guys have an idea what I missed?

Thanks in advance!

Comments

gábor hojtsy’s picture

Status: Active » Closed (works as designed)

Include the file, where the node_form() function is defined. I guess it is in node.pages.inc.

pancho’s picture

Oh my gosh, I forgot that...
Thank you!

winner’s picture

howto include the node.pages.inc,

$items['node/%/clone'] = array(
'title' => t('Clone'),
'page callback' => 'clone_node',
'page arguments' => array(1),
'access callback' => 'clone_access',
'type' => MENU_LOCAL_TASK,
'weight' => 5,
'file' => 'node.pages.inc',
);
it can not work, why?

gábor hojtsy’s picture

Unless node.pages.inc is in the same folder as the module, this will not work. Try drupal_get_path() to get a path to a module.

winner’s picture

i try as below:
$items['node/%/clone'] = array(
'title' => t('Clone'),
'page callback' => 'clone_node',
'page arguments' => array(1),
'access callback' => 'clone_access',
'type' => MENU_LOCAL_TASK,
'weight' => 5,
'file' => '/modules/node/node.pages.inc',
);

$items['node/%/clone'] = array(
'title' => t('Clone'),
'page callback' => 'clone_node',
'page arguments' => array(1),
'access callback' => 'clone_access',
'type' => MENU_LOCAL_TASK,
'weight' => 5,
'file' => drupal_get_path('module','node').'/node.pages.inc',
);

it can not work, thanks for Gábor Hojtsy.

Crell’s picture

You need the "file path" key, as per: http://drupal.org/node/146172

winner’s picture

thanks ,yes i need the 'file path' key. :)