Created
May 12, 2014 20:35
-
-
Save jasonrwasser/b74dfa35fed74e4f6daa to your computer and use it in GitHub Desktop.
Drupal - Search Button + Font Awesome
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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