From 1e944b7274b22b889e0470c5507f4328a5944cec Mon Sep 17 00:00:00 2001 From: Mark Carver Date: Fri, 20 Sep 2013 14:43:16 -0500 Subject: Issue #2094179 by Mark Carver, kslonka: Fix search block appearence --- includes/form.inc | 28 ++++++++++++---------------- template.php | 20 +++++++++++++------- templates/search-block-form.tpl.php | 6 ++++++ 3 files changed, 31 insertions(+), 23 deletions(-) create mode 100644 templates/search-block-form.tpl.php diff --git a/includes/form.inc b/includes/form.inc index a8b2cab..44e018a 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -23,22 +23,20 @@ function bootstrap_form_alter(&$form, &$form_state, $form_id) { * Implements hook_form_FORM_ID_alter() for search_form(). */ function bootstrap_form_search_form_alter(&$form, &$form_state) { - $form['#attributes']['class'][] = 'form-search'; - $form['#attributes']['class'][] = 'pull-left'; + // Add a clearfix class so the results don't overflow onto the form. + $form['#attributes']['class'][] = 'clearfix'; + // Remove container-inline from the container classes. + $form['basic']['#attributes']['class'] = array(); + + // Hide the default button from display. + $form['basic']['submit']['#attributes']['class'][] = 'element-invisible'; + + // Implement a theme wrapper to add a submit button containing a search icon + // directly after the input element. + $form['basic']['keys']['#theme_wrappers'] = array('bootstrap_search_form_wrapper'); $form['basic']['keys']['#title'] = ''; - $form['basic']['keys']['#attributes']['class'][] = 'search-query'; - $form['basic']['keys']['#attributes']['class'][] = 'col-sm-2'; $form['basic']['keys']['#attributes']['placeholder'] = t('Search'); - - // Hide the default button from display and implement a theme wrapper to add - // a submit button containing a search icon directly after the input element. - $form['basic']['submit']['#attributes']['class'][] = 'element-invisible'; - $form['basic']['keys']['#theme_wrappers'][] = 'bootstrap_search_form_wrapper'; - - // Apply a clearfix so the results don't overflow onto the form. - $form['#suffix'] = '
'; - $form['#attributes']['class'][] = 'content-search'; } /** @@ -48,14 +46,12 @@ function bootstrap_form_search_block_form_alter(&$form, &$form_state) { $form['#attributes']['class'][] = 'form-search'; $form['search_block_form']['#title'] = ''; - $form['search_block_form']['#attributes']['class'][] = 'search-query'; - $form['search_block_form']['#attributes']['class'][] = 'col-sm-2'; $form['search_block_form']['#attributes']['placeholder'] = t('Search'); // Hide the default button from display and implement a theme wrapper to add // a submit button containing a search icon directly after the input element. $form['actions']['submit']['#attributes']['class'][] = 'element-invisible'; - $form['search_block_form']['#theme_wrappers'][] = 'bootstrap_search_form_wrapper'; + $form['search_block_form']['#theme_wrappers'] = array('bootstrap_search_form_wrapper'); // Apply a clearfix so the results don't overflow onto the form. $form['#attributes']['class'][] = 'content-search'; diff --git a/template.php b/template.php index 4372937..ce22169 100755 --- a/template.php +++ b/template.php @@ -261,24 +261,30 @@ function bootstrap_process_block(&$variables, $hook) { * @ingroup themable */ function bootstrap_bootstrap_search_form_wrapper(&$variables) { - $output = '
'; + $output = '
'; $output .= $variables['element']['#children']; - $output .= ''; + $output .= ''; $output .= '
'; return $output; - } +} - /** +/** * Implements hook_preprocess_icon(). * * bootstrap need additional class glyphicon to display icons * * @see icon_preprocess_icon_image() * @see template_preprocess_icon() -*/ + */ function bootstrap_preprocess_icon(&$variables) { $bundle = &$variables['bundle']; diff --git a/templates/search-block-form.tpl.php b/templates/search-block-form.tpl.php new file mode 100644 index 0000000..aa19949 --- /dev/null +++ b/templates/search-block-form.tpl.php @@ -0,0 +1,6 @@ +
+ subject)): ?> +

+ + +
-- 1.8.3.4