Displaying another entity's form on a node I am trying to embed the edit form for a flag on my node (the full page view mode).
After some struggle, I finally figured out how to get the flagging form.  But once I have the form, how do I actually get it to display on the page?
function MYMODULE_node_view(array &amp;$build, NodeInterface $node, EntityViewDisplayInterface $display, $view_mode) {
  if ($node-&gt;getType() == 'MY_CONTENT_TYPE') {
    $flag = \Drupal::service('flag')-&gt;getFlagById('MY_FLAG_ID');
    $flagging_entity = \Drupal::service('flag')-&gt;getFlagging($flag, $node);
    $form = \Drupal::service('entity.manager')
      -&gt;getFormObject('flagging', 'edit')
      -&gt;setEntity($flagging_entity);
    $form_obtained = \Drupal::formBuilder()-&gt;getForm($form);
    // How do I actually show the form on the node?

I looked at this question on rendering forms (which says use the formBuilder service, which I am already using). I assume I need to put the form in a render array but the documentation is not clear about how to do that.
\Drupal::formBuilder()-&gt;getForm() already returns a render array, see the FormBuilder::getForm() documentation.
To render the form, you just need to pass the results of getForm() to your $build array, then render it in your template.
In hook_ENTITY_TYPE_view():
function MYMODULE_node_view(array &amp;$build, NodeInterface $node, EntityViewDisplayInterface $display, $view_mode) {
  // ...
  $build['my_flagging_form'] = $form_obtained;
}

Then in your twig template:
{{ content.my_flagging_form }}

Or, if you're already rendering content in its entirety, you may not need to update your twig template at all.
As @4k4 noted in the comments, you can also add the appropriate meta data in hook_entity_extra_field_info to make your flagging form addition configurable (reorderable, etc) on your node's Manage Display screen. See Creating pseudo-fields in Drupal 8 for an example.