Last active
August 29, 2015 14:03
-
-
Save pmackay/3e2f102a8d3d9778e3ae to your computer and use it in GitHub Desktop.
Setting up a search API search bar in Kalatheme
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 if ($search_form): ?> | |
<?php print $search_form; ?> | |
<?php endif; ?> |
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
function theme_preprocess_page(&$variables) { | |
$variables['search_form'] = ''; | |
if (module_exists('search') && user_access('search content')) { | |
$search_box_form = drupal_get_form('search_form'); | |
$search_box_form['basic']['keys']['#title'] = ''; | |
$search_box_form['basic']['keys']['#attributes'] = array('placeholder' => 'Search this site'); | |
$search_box_form['basic']['keys']['#attributes']['class'][] = 'search-query'; | |
$search_box_form['basic']['submit']['#value'] = t('Search'); | |
$search_box = drupal_render($search_box_form); | |
$variables['search_form'] = (user_access('search content')) ? $search_box : NULL; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment