I've been looking all over the internet for a full day or so by now, and can't find anything about it.

I'm using CCK to manage my content types as objects and their appropriate fields/databases. Because there is some complicated relationship between the content types and nodes, I am trying to create some intuitive flow in order to properly create these nodes. This involves getting information from forms and programatically creating nodes through node_save($node).

I could recreate all the fields on a custom form and save them to a $node object, but I would at least like to use the options, field descriptions, titles, and possibly validation that is used by cck on a typical form.

So my main question is this: How do I get and render a specific field from a content type? Is there some function that returns a field array I can add to my form array?

In D5, I got so far as fully embedding a cck form through this code:

$node = array('uid' => $user->uid, 'name' => $user->name, 'type' => 'budget_period');
$output .= drupal_get_form('budget_period_node_form',$node);

But in D6, I can't even do that: I get the following error:

warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'node_form' was given in /home/sugroups/public_html/includes/form.inc on line 366.

Ideas? Thanks in advance.

Comments

timtrinidad’s picture

Bump - no one's tried this?

pingers’s picture

module_load_include('pages.inc', 'node');

Try that ;) The file containing node_form hasn't been included yet.

srodriguez’s picture

I am working on something similar in making a more simple toned down form for non websavvy people to enter in nodes in Drupal 5. Thanks

timtrinidad’s picture

@Pingers, sounds good.

What about certain fields, instead of just the entire form?

pingers’s picture

I'm not sure... Maybe content_fields function...

See content.module for the definition.

Cheers!

jordanmagnuson’s picture

Bump.