GET method form is not processed I want to build kind of a search form in Drupal 8: On submit, it shall load itself again, but below the results shall rendered. And the URL shall contain the search term, so that the result page is linkable.

This is my minimal example. My current problem ist, that the submitted form value is not fed to $form_state.

public function buildForm(array $form, FormStateInterface $form_state) {

  $form_state-&gt;setMethod('get');

  $query = $form_state-&gt;getValue('query');
  // Unfortunately, this is empty, even after submit.

  $form['query'] = array(
    '#type' =&gt; 'textfield',
    '#title' =&gt; $this-&gt;t('Query'),
  );
  $form['actions']['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; $this-&gt;t('Search'),
  );

  return $form;
}

public function submitForm(array &amp;$form, FormStateInterface $form_state) {
  $form_state-&gt;setRebuild();
  $form_state-&gt;setAlwaysProcess(TRUE);
}


When I comment out $form_state-&gt;setMethod('get');, it is working as I want: query is readable in the rebuild form and set as default value in the text field. 

But with setMethod('get');, query is empty and no default is set.

I thought that $form_state-&gt;setAlwaysProcess(TRUE); makes sure the values get processed, even via GET method, as the documentation suggests. But apparently, something is missing. Any ideas, what?
I could solve the problem myself, based on this solution for Drupal 7.

Instead calling the form directly in the router, I define a page callback in my_module.routing.yml.

my_module.form:
  path: '/my-module-form'
  defaults:
    _title: 'My module form'
    _controller: '\Drupal\my_module\Controller\MyModuleController::searchForm'


In MyModuleController, I load my form via the builder.

public function searchForm() {

  $form_state = new FormState();
  $form_state-&gt;setMethod('get');
  $form_state-&gt;setAlwaysProcess(TRUE);
  $form_state-&gt;setRebuild();

  $form = \Drupal::formBuilder()-&gt;buildForm('Drupal\my_module\Form\MyModuleSearchForm', $form_state);
  unset($form['form_build_id']);
  unset($form['form_id']);

  return $form;
}


The code of form then is like in the question above.