You are here

10 May 2011

How to place Drupal node comment form to anywhere in your module or theme.

Source code viewer
  1. $node = node_load(arg(3));
  2.  
  3. $edit = array(
  4. 'nid' => $node->nid,
  5. 'name' => '',
  6. 'mail' => '',
  7. 'homepage' => '',
  8. 'subject' => '',
  9. 'comment' => '',
  10. 'cid' => NULL,
  11. 'pid' => NULL,
  12. 'language' => LANGUAGE_NONE,
  13. 'uid' => 0
  14. );
  15.  
  16. echo render(drupal_get_form('comment_node_'.$node->type.'_form', (object)$edit));
Programming Language: PHP