How can I insert fields from custom content to custom form?
An entity can have multiple form modes, so you can exclude some fields in different form modes and leave fields that you want to display.
So, you can create form mode &quot;custom_form_mode&quot;, go to manage fields, choose &quot;custom_form_mode&quot; and arrange fields.
In the custom code, you can use the code that you mention in #1, but with an extra argument in the getForm method, which is $operation, and that one is the form mode that you want to use to display form.
$node = \Drupal\node\Entity\Node::create(['type' =&gt; 'my_students']);
$form = \Drupal::service('entity.form_builder')-&gt;getForm($node, 'custom_form_mode');
return $form