The code bellow is to be used in any module. It requires cck module to be installed. The advantage of this code is that it allows you to use labels and field definitions done through the cck ui. It allowed me to build a custom form based in the fields previously defined, it saves time and keeps your custom form consistent with the content type form.
<?php
global $user;
$type = 'my_content_type';
$node = array(
'uid' => $user->uid,
'name' => (isset($user->name) ? $user->name : ''),
'type' => $type,
'language' => '',
);
$form_state = array();
$form = node_form($form_state, $node);
drupal_prepare_form($type . '_node_form', $form, $form_state);
print '<pre>'.check_plain(print_r(element_children($form), true)).'</pre>';
?>
Thanks, but this not worked for me. I had an error with node_form().
I found a better solution at http://drupal.org/node/357895#comment-1311764.
Hum, your captcha are too small...
Yes, your solution seems better.
Thanks
Post new comment