I have searched a lot, but dont find the right way to do this. So what i want is to load the form for a node, the same form as if i am editing a node, something like: $node = node_load(1); $form = get_the_edit_form_for_this_node($node); I try: $node = node_load(1); $form = drupal_get_form('article_node_form', $node); But the resulting $form do not have the fields and the values for this node. Thanks for any help.
You can look at the node.module (probably actually node.pages.inc?) and get the form name, but I think it is actually "node_form_type." And I believe you'll need to recast the object to an array. Something like, $form = drupal_get_form('node_form_article', (array) $node); Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
________________________________ From: Fernando Conceição
I have searched a lot, but dont find the right way to do this. So what i want is to load the form for a node, the same form as if i am editing a node, something like:
$node = node_load(1); $form = drupal_get_form('article_node_form', $node);
Actually it's: module_load_include('inc', 'node', 'node.pages'); $form = drupal_get_form($node->type .'_node_form', $node); [OR] $form = node_page_edit($node); // This will also set the page title with the node title Make sure to load the node.pages.inc file so that everything Jamie Holly http://www.intoxination.net http://www.hollyit.net On 6/12/2011 8:24 PM, Ms. Nancy Wichmann wrote:
You can look at the node.module (probably actually node.pages.inc?) and get the form name, but I think it is actually "node_form_/type./" And I believe you'll need to recast the object to an array. Something like,
$form = drupal_get_form('node_form_article', (array) $node);
/*Nancy*/
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
------------------------------------------------------------------------ *From:* Fernando Conceição
I have searched a lot, but dont find the right way to do this. So what i want is to load the form for a node, the same form as if i am editing a node, something like:
$node = node_load(1); $form = drupal_get_form('article_node_form', $node);
Thanks, Jamie. That's why I try not to code off the top of my head, or after a very eventful day. Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
________________________________ From: Jamie Holly <hovercrafter@earthlink.net> To: development@drupal.org Sent: Sunday, June 12, 2011 8:33 PM Subject: Re: [development] Get the form for a node
Actually it's:
module_load_include('inc', 'node', 'node.pages'); $form = drupal_get_form($node->type .'_node_form', $node);
[OR]
$form = node_page_edit($node); // This will also set the page title with the node title
Make sure to load the node.pages.inc file so that everything
Jamie Holly http://www.intoxination.net http://www.hollyit.net On 6/12/2011 8:24 PM, Ms. Nancy Wichmann wrote: You can look at the node.module (probably actually node.pages.inc?) and get the form name, but I think it is actually "node_form_type." And I believe you'll need to recast the object to an array. Something like,
$form = drupal_get_form('node_form_article', (array) $node);
Nancy
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
________________________________ From: Fernando Conceição
I have searched a lot, but dont find the right way to do this. So what i want is to load the form for a node, the same
form as if i am editing a node, something like:
$node = node_load(1); $form = drupal_get_form('article_node_form', $node);
Ms. Nancy Wichmann wrote:
Thanks, Jamie. That's why I try not to code off the top of my head, or after a very eventful day.
An eventful day is one where I spend 22 hours in a chair installing an upgrade of a vendor product that requires an OS rebuild, cluster software reinstall, backup software reinstall, a database vendor software install, other third party installs, a database upgrade, thick and thin client GUI upgrades and the upgrade of the software itself in two different data centers located in two differing states involving four UNIX systems and knowing that now I must test failover between the hosts of the cluster because we ran out of time to do that part as well as knowing that I must do it again this coming weekend for a different product from the same vendor. Now, that is an eventful day. Thanks for letting me vent and ask your forgiveness in the hijack of the thread. When I saw the "eventful day" comment it just got me going. -- Earnie -- http://progw.com -- http://www.for-my-kids.com
Er.... I don't think eventful days sound like much fun.... ;) It's like the old chinese curse..... "May you live in interesting times". Good luck, Earnie! On Jun 13, 2011, at 6:16 AM, Earnie Boyd wrote:
Ms. Nancy Wichmann wrote:
Thanks, Jamie. That's why I try not to code off the top of my head, or after a very eventful day.
An eventful day is one where I spend 22 hours in a chair installing an upgrade of a vendor product that requires an OS rebuild, cluster software reinstall, backup software reinstall, a database vendor software install, other third party installs, a database upgrade, thick and thin client GUI upgrades and the upgrade of the software itself in two different data centers located in two differing states involving four UNIX systems and knowing that now I must test failover between the hosts of the cluster because we ran out of time to do that part as well as knowing that I must do it again this coming weekend for a different product from the same vendor. Now, that is an eventful day.
Thanks for letting me vent and ask your forgiveness in the hijack of the thread. When I saw the "eventful day" comment it just got me going.
-- Earnie -- http://progw.com -- http://www.for-my-kids.com
I suppose it depends on what events are involved. Mine had nothing to do with Drupal, or even anything to do with computers. I was baptized, which is much more "work" for an adult than for an infant. But it was kind of nice not even seeing a computer for a day. Nancy Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
________________________________ From: David Metzler
Er.... I don't think eventful days sound like much fun.... ;)
It's like the old chinese curse..... "May you live in interesting times".
Good luck, Earnie!
Cool! Congrats! On Jun 13, 2011, at 7:19 AM, Ms. Nancy Wichmann wrote:
I suppose it depends on what events are involved. Mine had nothing to do with Drupal, or even anything to do with computers. I was baptized, which is much more "work" for an adult than for an infant. But it was kind of nice not even seeing a computer for a day.
Nancy
Injustice anywhere is a threat to justice everywhere. -- Dr. Martin L. King, Jr.
From: David Metzler
Er.... I don't think eventful days sound like much fun.... ;)
It's like the old chinese curse..... "May you live in interesting times".
Good luck, Earnie!
Em 12-06-2011 21:33, Jamie Holly escreveu:
Actually it's:
module_load_include('inc', 'node', 'node.pages'); $form = drupal_get_form($node->type .'_node_form', $node);
[OR]
$form = node_page_edit($node); // This will also set the page title with the node title
Make sure to load the node.pages.inc file so that everything
The line: module_load_include('inc', 'node', 'node.pages'); Make all the diference and now works as i want, thanks.
participants (5)
-
David Metzler -
Earnie Boyd -
Fernando Conceição -
Jamie Holly -
Ms. Nancy Wichmann