You are here

function better_search_form_search_block_form_alter in Better Search Block 7

Implements hook_form_FORM_ID_alter().

File

./better_search.module, line 22

Code

function better_search_form_search_block_form_alter(&$form, &$form_state, $form_id) {
  $path = drupal_get_path('module', 'better_search');
  $theme = variable_get('theme', 0);
  switch ($theme) {
    case 0:
      $form['#attached']['css'][] = $path . '/css/background_fade.css';
      break;
    case 1:
      $form['#attached']['css'][] = $path . '/css/expand_on_hover.css';
      break;
    case 2:
      $form['#attached']['css'][] = $path . '/css/increase_icon_size.css';
      break;
    case 3:
      $form['#attached']['css'][] = $path . '/css/on_hover_button.css';
      break;
  }
  if ($theme == 3) {
    $form['search_block_form']['#suffix'] = ' <button class="icon"><i class="better_search"></i></button>';
  }
  else {
    $form['search_block_form']['#prefix'] = '<div class="icon"><i class="better_search"></i></div>';
  }
  $form['search_block_form']['#attributes']['placeholder'] = t(variable_get('placeholder_text', 'search'));
  $form['actions']['#attributes']['class'][] = 'element-invisible';
  $form['search_block_form']['#size'] = variable_get('size', 20);

  // Change the color of input search text.
  drupal_add_css('#search-block-form .form-item-search-block-form input.form-text{color:' . variable_get('placeholder_color', '#FFFFFF') . '}', 'inline');
}