Drupal - bring node form from Create Content > [Node Type] to a custom menu
at this time, I'm able to add software node type by using node type form in Create Content > Software menu. But I want to place this form to a custom menu. This is my menu:
'software/add' => array(
'title' => 'Add Software',
'page callback' => '???',
'access callback' => TRUE,
),
I'm managed to make an admin form in custom menu by us开发者_C百科ing page callback and system_settings_form. So I guess I must work around with page callback, but I don't know how to do it with node type form.
Ok, sometimes I need this kind of menu items, the code follows:
$items['software/add'] = array(
'title' => 'Add Software',
'page callback' => 'node_add',
'page arguments' => array('software'),
'access callback' => 'node_access',
'access arguments' => array('create', 'software'),
'file' => 'node.pages.inc',
'file path' => drupal_get_path('module', 'node'),
);
You could simply go to the menu item and re-assign it to your other menu in the GUI. Or you could look to the node.module, which is the module that currently handles that hook_menu implementation:
$items['node/add'] = array(
'title' => 'Create content',
'page callback' => 'node_add_page',
'access callback' => '_node_add_access',
'weight' => 1,
'file' => 'node.pages.inc',
);
精彩评论