Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By xxxLOGIATxxx on
Hey. Can anybody explain how to customize default search block form? For example how can i change submit button type
to hidden
? If you give an example would be nice. I'm stuck a little bit.
Comments
I think i know what to do! :)
I think i know what to do! :)
In file THEMENAME.theme:
/**
* Implementation of hook_form_alter().
*/
function THEMENAME_form_search_block_form_alter(&$form, &$form_state, $form_id) {
$form['#attributes']['class'][] = 'searchForm';
$form['keys']['#attributes']['placeholder'] = t('Search...');
$form['actions']['submit'] = array(
'#type' => 'hidden'
);
}