How can i add an additional class the Drupal’s search form’s submit button?

91 views Asked by At

I’m trying to add an additional class to the Search form’s submit button. I’m attempting to display a icon font instead of the word Search. The mark-up for this button w/ my added class would be this

<input type=“submit” id=“someid” value=“” class=“form-submit flaticon-magnifier12” /> 

i’ve successfully removed the word search from the value field by modifying the search.module file. i looked for a ref. to the class ‘form-submit’ but it is not in that file.

i also tried the following in the template.php file.

function mytheme_form_alter(&$form, &$form_state, $form_id){
if($form_id == 'search_block_form'){
    $form[actions][submit][‘#class’] = ‘form-submit flaticon-     magnifier12’;
}
}

but that didn’t work!, any help in this matter would be greatly appreciated.

1

There are 1 answers

0
AlexM On

You should use:

$form['actions']['submit']['#attributes']['class'][] = "form-submit flaticon";