You are here

function template_preprocess_google_appliance_search_form in Google Search Appliance 7

Preprocess the full search form.

File

theme/google_appliance.theme.inc, line 137
theme registry and preprocess functions for the default templates

Code

function template_preprocess_google_appliance_search_form(&$vars) {
  $vars['search_form'] = array();
  $hidden = array();

  // Vars named after form keys so themers can print each element independently.
  foreach (element_children($vars['form']) as $key) {

    // token = FALSE on search form means '#type' wont be there
    // put the option check here while we wait and see if the tooken-to-false
    // solution for Varnish caching issue actually solves the problem in the wild
    $type = array_key_exists('#type', $vars['form'][$key]) ? $vars['form'][$key]['#type'] : '';
    if ($type == 'hidden' || $type == 'token') {
      $hidden[] = drupal_render($vars['form'][$key]);
    }
    else {
      $vars['search_form'][$key] = drupal_render($vars['form'][$key]);
    }
  }

  // No theming value on hidden elements, so collapse them.
  $vars['search_form']['hidden'] = implode($hidden);

  // Collect the whole shebang so the complete form can be rendered with one var.
  $vars['search_form_complete'] = implode($vars['search_form']);

  // Render template.
}