Function to retrieve a content type form array

Oz's picture

.code {
background: #ffffd0; margin: 12px 12px 12px 12px; padding: 3px 3px 3px 3px;
}

//$form['#field_info'] contains information about cck fields
function _cck_form_array($type) {
module_load_include('inc', 'node', 'node.pages');
global $user;
$form_state = array();
$node = array('type' => $type, 'uid' => $user->uid, 'name' => $user->name);
$form = drupal_retrieve_form($type.'_node_form',$form_state,$node);
drupal_prepare_form($type.'_node_form', $form, $form_state);
return $form;
}