How do I add a class to the search block form? I want to add a class to the &lt;form&gt; element on the form_id 'search_block_form'

this is my current code

function THEME_form_search_block_form_alter(&amp;$form, &amp;$form_state, $form_id) {
  $form['#attributes']['class'][] = 'form-inline ';

}
You can use the template_preprocess_form

function THEMENAME_preprocess_form(&amp;$vars) {
  // Add class to your specific form
  if ($vars['attributes']['id'] == 'search-block-form') {
    $vars['attributes']['class'][] = 'form-inline ';
  }
}


NOTE: the preprocessor you are using adds class to the block element