function google_appliance_search_form in Google Search Appliance 6.2
Same name and namespace in other branches
- 7 google_appliance.module \google_appliance_search_form()
Define the search form.
3 string references to 'google_appliance_search_form'
- google_appliance_block in ./
google_appliance.module - Implementation of hook_block().
- google_appliance_search_view in ./
google_appliance.module - Search page results.
- theme_google_appliance_search_form in ./
google_appliance.module
File
- ./
google_appliance.module, line 1430 - Google Search Appliance (GSA) / Google Mini integration
Code
function google_appliance_search_form(&$form_state, $prompt = NULL, $search_base = NULL, $client = NULL, $collection = NULL, $keys = '') {
$settings = google_appliance_get_settings();
if (is_null($prompt)) {
$prompt = t('Enter your keywords');
}
// Establish client and collection using (1) function args, (2) path args, (3) defaults.
if (!$client || !$collection) {
if (arg(0) == 'google-appliance' && arg(1) && arg(2)) {
$client = $client ? $client : arg(1);
$collection = $collection ? $collection : arg(2);
}
$client = $client ? $client : variable_get('google_appliance_default_client', 'default_frontend');
$collection = $collection ? $collection : variable_get('google_appliance_default_collection', 'default_frontend');
}
// Determine the base path that we should redirect to on submission
if (!$search_base) {
$search_base = 'search/' . $settings['default_search_path'];
}
elseif ($search_base == 'google-appliance') {
if (arg(1) && arg(2)) {
$search_base = $settings['google_appliance_path'] . '/' . arg(1) . '/' . arg(2);
}
else {
$client_arg = google_appliance_client_to_arg($settings['default_client']);
$collection_arg = google_appliance_collection_to_arg($settings['default_collection']);
$search_base = $settings['google_appliance_path'] . '/' . $client_arg . '/' . $collection_arg;
}
}
$form['#google_appliance_search_base'] = $search_base;
$form['#attributes'] = array(
'class' => 'search-form',
);
$form['keys'] = array(
'#type' => 'textfield',
'#title' => $prompt,
'#default_value' => $keys,
'#size' => $prompt ? 40 : 20,
//from search_form(). hacky little way of dealing with block vs page.
'#maxlength' => 255,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Search'),
);
return $form;
}