I added some search block in my theme, and I placed each of them in a custom place.
I want to edit each of theme by using function hook_form_FORM_ID_alter for this purpose.
Provide a form-specific alteration instead of the global hook_form_alter().
Modules can implement hook_form_FORM_ID_alter() to modify a specific form, rather than implementing hook_form_alter() and checking the form ID, or using long switch statements to alter multiple forms.
How can I find each search block form ID? How can I edit them in ThemeName_form_search_block_form_alter()
to add special classes to each of them?
I used the Devel module for this purpose, but It seems that for the Devel module, all those forms have the same ID (search_block_form).
This is the code I used.
function ThemeName_form_search_block_form_alter(&$form, &$form_state, $form_id) {
drupal_set_message(kint($form));
$form['keys']['#attributes']['placeholder'][] = t('Search');
$form['actions']['submit']['#attributes']['class'][] = 'my-class';
}