Use Token in contact form as default value I have a contact form build from the drupal core contact forms.

I am trying to prefill some fields from URL GET parameters like this. /?foo=bar But it seems that "default value" doesnt support tokens.

I want to use something like this: [current-page:url:args:value:foo] in the default field of my form field.

But this gets just rendered as plain text.
Any help is appreciated.

EDIT: Working solution with form_alter:

function MY_MODULE_form_alter(&amp;$form, &amp;$form_state) {
  $args = \Drupal::request()-&gt;query-&gt;all();
  $form['field_test']['widget'][0]['value']['#default_value'] = $args['foo'];
}


Maybe there is a solution with tokens relating to the topic?
Usually this is done in hook_form_contact_site_form_alter, like this:

function YOUR_MODULE_form_contact_site_form_alter(&amp;$form, &amp;$form_state) {
      $args = \Drupal::request()-&gt;query-&gt;all();
      $form['subject']['#default_value'] = $args['foo'];
}