Function call add node form

WE HAVE MOVED!

Please visit our new Drupal Website at https://www.xenyo.com我們的新網頁設計公司網頁.

<?php
function create_node_form(){
module_load_include('inc', 'node', 'node.pages'); 
 
  global $user;
  $type = 'content_type_name';
  $node = (object) array(
    'uid' => $user->uid,
    'name' => (isset($user->name) ? $user->name : ''),
    'type' => $type,
    'language' => LANGUAGE_NONE,
	'field_name' => array('und' => array(0 => array('value' => 'default_value'),),),  
  );
 
  drupal_set_title(t('Create New Content'), PASS_THROUGH);
  $output = render(drupal_get_form($type . '_node_form', $node));
 
  return $output;
}
 
?>
 
 
//call add node form 
<?php
  print create_node_form();
?>
Help Share this Article