Skip to content

Instantly share code, notes, and snippets.

@jasonrwasser
Created May 12, 2014 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jasonrwasser/b74dfa35fed74e4f6daa to your computer and use it in GitHub Desktop.
Save jasonrwasser/b74dfa35fed74e4f6daa to your computer and use it in GitHub Desktop.
Drupal - Search Button + Font Awesome
<?php
/**
* Implements hook_form_alter
* @param $form
* @param $form_state
* @param $form_id
*/
function hook_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'search_block_form') {
$form['search_block_form']['#attributes']['placeholder'] = t('Search');
$form['button'] = array(
'#type' => 'item',
'#markup' => '<button type="submit" id="edit-submit-btn" name="op" class="form-submit"><i class="fa fa-search"></i></button>',
'#weight' => 1000,
);
}
}
/**
* Implements hook_preprocess_html
* @param $variables
*/
function hook_preprocess_html(&$variables) {
drupal_add_css('http://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css', array('type' => 'external'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment