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
Comment #1
gábor hojtsyInclude the file, where the node_form() function is defined. I guess it is in node.pages.inc.
Comment #2
panchoOh my gosh, I forgot that...
Thank you!
Comment #3
winner commentedhowto 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?
Comment #4
gábor hojtsyUnless 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.
Comment #5
winner commentedi 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.
Comment #6
Crell commentedYou need the "file path" key, as per: http://drupal.org/node/146172
Comment #7
winner commentedthanks ,yes i need the 'file path' key. :)