Skip to content

Instantly share code, notes, and snippets.

@tmsss
Last active November 5, 2015 17:30
Show Gist options
  • Select an option

  • Save tmsss/39802c8b84ffafcfec12 to your computer and use it in GitHub Desktop.

Select an option

Save tmsss/39802c8b84ffafcfec12 to your computer and use it in GitHub Desktop.
Customize the Search Block in Drupal 7 (from https://www.drupal.org/node/1021902)
function MYTHEME_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'search_block_form') {
$form['actions']['button']['#prefix'] = '<button type="submit">';
$form['actions']['button']['#suffix'] = '</button>';
$form['actions']['button']['#markup'] = '<i class="icon-search"></i>';
}
}
function template_preprocess_page(&$variables){
$search_form = drupal_get_form('search_form');
$search_form_box = drupal_render($search_form);
$variables['search_box'] = $search_form_box;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment