You are here

function template_preprocess_google_appliance_block_form in Google Search Appliance 7

Preprocess block search form

File

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

Code

function template_preprocess_google_appliance_block_form(&$vars) {
  $vars['block_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['block_search_form'][$key] = drupal_render($vars['form'][$key]);
    }
  }

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

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

  // Render template.
}