How to combine block form submit result with on fly created content together in Drupal 8 I write a custom module in Drupal 8.

Have my custom block defined:

class MyBlock extends BlockBase {
    /**
     * {@inheritdoc}
     */
    public function build(){
     $form = \Drupal::formBuilder()-&gt;getForm('Drupal\mymodule\Form\myform');
     $markup = bunch of html here;
     $content = data feed from 3rd party;
     return array(
      '#markup' =&gt; $form + $markup + $content,
     );
  }
}


What I want is, that after block build have both form and feed data in format html way show up.
Any suggestions will be appreciated.
There are two ways you can do this. You can put the results in the form, or you can put the results in the block. Choosing which one to do will depend upon how the form should work - if you were to use this form in another location, and would want the results to show in that location as well, then you should put the results in the form as follows:

function some_form(array &amp;$form, FormStateInterface $form_state) {

  // Note: Form build not shown.

  $results = some_function_that_returns_results();
  $form['results'] = [
    '#prefix' =&gt; '&lt;div id="results_wrapper"&gt;',
    '#suffix' =&gt; '&lt;/div&gt;',
  ];
  foreach ($results as $result) {
    $form['results'][] = [
      '#prefix' =&gt; '&lt;div class="result"&gt;',
      '#suffix' =&gt; '&lt;/div&gt;',
      '#markup' =&gt; $result,
    ];
  }

  return $form;
}


If you only want the results to show if the form is in the block, and not in other places where the form would be shown, you add the results to the block as follows:

public function build(){
  $form = \Drupal::formBuilder()-&gt;getForm('Drupal\mymodule\Form\myform');
  $markup = bunch of html here;
  $content = ‘some data’;

  $block = [
    'form' =&gt; $form,
    'markup' =&gt; [
      '#markup' =&gt; $markup
    ],
    'content' =&gt; [
      '#markup' =&gt; $content,
    ],
  ];

  $results = some_function_that_returns_results();
  $block['results'] = [
    '#prefix' =&gt; '&lt;div id="results_wrapper"&gt;',
     '#suffix' =&gt; '&lt;/div&gt;',
  ];
  foreach ($results as $result) {
    $block['results'][] = [
      '#prefix' =&gt; '&lt;div class="result"&gt;',
      '#suffix' =&gt; '&lt;/div&gt;',
      '#markup' =&gt; $result,
    ];
  } 
}