Adding a view to node edit form How to attach programmatically a view to the edit node form in Drupal 8?

In D7 I could achieve this by using this code

/**
 * Implements of hook_form_alter().
 */
function MYMODULE_form_alter(&amp;$form, &amp;$form_state, $form_id){

  // target a single form only
  if ($form_id == "form_id") {

    $form['html_markup'] = [
      '#markup' =&gt; views_embed_view('name_of_view','default'),
      '#weight' =&gt; 1
    ];    
  }
}


I'm looking for a way how can it implemented in D8.

Any tips will be appreciated!
I researched this for a while, then I found a sample implementation in modules/views/tests/modules/views_test_data/src/Form/ViewsTestDataElementEmbedForm.php:

$form['view'] = [
  '#type' =&gt; 'view',
  '#name' =&gt; 'test_view_embed',
  '#display_id' =&gt; 'embed_1',
  '#arguments' =&gt; [25],
  '#embed' =&gt; TRUE,
];


In that file it is used in FormBase::buildForm, but it works nicely also in hook_form_FORM_ID_alter(); I reported another example in this comment to a similar post.