Programmatically create a comment form for a node I'm trying to port a theme from Drupal 6 to Drupal 8, and I find code like the following.

$edit = array();
$edit['nid'] = $node-&gt;nid;
$form = drupal_get_form('comment_form', $edit));


How do I load the form in Drupal 8? I get the following error:


  Fatal error: Call to a member function getEntityTypeId() on null in /www/site/core/lib/Drupal/Core/Entity/EntityForm.php on line 77


The line causing the error is the following one:

\Drupal::formBuilder()-&gt;getForm('Drupal\comment\CommentForm');


I can't work out how to pass the node object to the form builder. How can I do it?
FormBuilder::getForm() doesn't accept just an argument; after the first, the other arguments are:


  Any additional arguments are passed on to the functions called by \Drupal::formBuilder()->getForm(), including the unique form constructor function. For example, the node_edit form requires that a node object is passed in here when it is called. These are available to implementations of hook_form_alter() and hook_form_FORM_ID_alter() as the array $form_state->getBuildInfo()['args'].


So, \Drupal::formBuilder()-&gt;getForm('Drupal\comment\CommentForm', $node); would be perfectly fine. It's up to the form builder, using those arguments.