So I've got Font Awesome working on my Drupal 7 site. I'm not using the Font Awesome Drupal module. I'm just declaring the style sheet in the template.php.
function genchstyle_preprocess_html(&$variables) {
drupal_add_css(
'http://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css',
array('type' => 'external')
);
}
Now, if I use <i class="icon-search"></i>
, I get a nice little magnifying glass icon.
I've recently learned how to replace a form's Submit button with an image like this.
function genchstyle_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'search_block_form') {
$form['actions']['submit']['#type'] = 'image_button';
$form['actions']['submit']['#src'] = drupal_get_path('theme', 'genchstyle') . 'images/search.png';
$form['actions']['submit']['#attributes']['class'][] = 'icon-search';
}
}
I can't figure out how to replace the submit button with the Font Awesome icon. I tried adapting the above script to use $form['actions']['submit']['#markup']
and I can get it to replace the button with the icon, but then the icon is no longer a functioning submission trigger (or even a link).
I've reviewed all the Font Awesome examples and googled the heck out of this but I can't find a solution.
Any suggestions?
<input>
tag to an<i>
tag you won't be able to submit the form any more; I'm pretty sure you can't do what you want without some sort of javascript kludge