How to load the node edit/create form
Given $node
, this is how you get the edit form ($node_form
).
$form = \Drupal::entityTypeManager()->getFormObject('node', 'default')->setEntity($node);
$node_form = \Drupal::formBuilder()->getForm($form);
Given $node
, this is how you get the edit form ($node_form
).
$form = \Drupal::entityTypeManager()->getFormObject('node', 'default')->setEntity($node);
$node_form = \Drupal::formBuilder()->getForm($form);