Form custom with method GET remove form_build_id and op from GET variables If I create a custom form with get method:

$form['#method'] = 'get';


When I click the submit button, many variables are populated with GET
Can I remove them cleanly according to the drupal logic?
You need to alter the form after it has been built, for example

$build = [];
$build['filter'] = $this-&gt;formBuilder-&gt;getForm(LibrarySearch::class);
$build['filter']['form_id']['#access'] = FALSE;
$build['filter']['form_build_id']['#access'] = FALSE;
$build['filter']['form_token']['#access'] = FALSE;


Once the form has been turned into a render array, you can set the access to FALSE for those items. This is also documented in the core Search module.