1

I would like to integrate a nodes edit form on a page. For example, I want to alter the node with ID id equal to 1.
I know there are a lot of ways to achieve this, but I can imagine there is only one right way.

I am having some troubles with my form. After certain time, the edit form shows values from different nodes: some from this, some from the other, etc. I really don't know why.

3
  • 1
    What do you mean by node as form? Do you mean the edit form for of the existing nodes? Or the create node form to create new nodes?
    – AjitS
    Jun 5, 2013 at 6:16
  • edit form of existing node can be found at node/[nid]/edit after some time you just redirect user to edit form, will this work ?
    – niksmac
    Jun 5, 2013 at 6:40
  • I would like to integrate this form into page, so i have to go another way.
    – gregab
    Jun 5, 2013 at 7:09

1 Answer 1

3

Use drupal_get_form(NODETYPE . '_node_form', NODEOBJECT); as callback in your custom menu item.

The original node module callback for menu item 'node/%node/edit' is located in the node.pages.inc file:

/**
 * Menu callback; presents the node editing form.
 */
function node_page_edit($node) {
  $type_name = node_type_get_name($node);
  drupal_set_title(t('<em>Edit @type</em> @title', array('@type' => $type_name, '@title' => $node->title)), PASS_THROUGH);
  return drupal_get_form($node->type . '_node_form', $node);
}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.