function search_autocomplete_admin_settings in Search Autocomplete 6
Same name and namespace in other branches
- 5 search_autocomplete.module \search_autocomplete_admin_settings()
1 string reference to 'search_autocomplete_admin_settings'
File
- ./
search_autocomplete.module, line 33
Code
function search_autocomplete_admin_settings() {
$form = array();
$form['search_autocomplete_hook'] = array(
'#type' => 'fieldset',
'#title' => t('Apply autocomplete search on fields'),
'#description' => t('Choose the field to apply search autocomplete'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['search_autocomplete_hook']['search_autocomplete_hook_search'] = array(
'#type' => 'checkbox',
'#title' => t('Apply autocomplete search on the search form'),
'#default_value' => variable_get("search_autocomplete_hook_search", 0),
'#return_value' => 1,
'#required' => FALSE,
);
$form['search_autocomplete_hook']['search_autocomplete_hook_search_box'] = array(
'#type' => 'checkbox',
'#title' => t('Apply autocomplete search on the search box form'),
'#default_value' => variable_get("search_autocomplete_hook_search_box", 0),
'#return_value' => 1,
'#required' => FALSE,
);
$form['search_autocomplete_hook']['search_autocomplete_hook_search_block'] = array(
'#type' => 'checkbox',
'#title' => t('Apply autocomplete search on the search block form. (need the module <a href="http://drupal.org/project/search_block" target="_blank">Search Block</a>)'),
'#default_value' => variable_get("search_autocomplete_hook_search_block", 0),
'#return_value' => 1,
'#required' => FALSE,
);
$form['search_autocomplete_setting'] = array(
'#type' => 'fieldset',
'#title' => t('Autocomplete webservice settings'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
);
$form['search_autocomplete_setting']['search_autocomplete_method'] = array(
'#type' => 'radios',
'#title' => t('Choose a search method'),
'#default_value' => variable_get('search_autocomplete_method', 1),
'#options' => array(
'1' => t('Natural sort (no sort)'),
'2' => t('Sort keyword alphabetically'),
'3' => t('Sort by keyword\'s score'),
'4' => t('Sort by keyword\'s relevance (slow)'),
),
'#description' => t("Caution: Some request method can be very slow !"),
'#autocomplete_path' => 'search_autocomplete/autocomplete',
'#required' => TRUE,
);
$trigger = array();
for ($i = 1; $i < 20; $i++) {
$trigger[$i] = $i . ' ' . t('characters');
}
$form['search_autocomplete_setting']['search_autocomplete_trigger'] = array(
'#type' => 'select',
'#title' => t('Minimum keyword size that uncouple autocomplete search'),
'#default_value' => variable_get('search_autocomplete_trigger', variable_get('minimum_word_size', 3)),
'#options' => $trigger,
'#multiple' => FALSE,
'#required' => TRUE,
);
$limit = array();
for ($i = 1; $i < 50; $i++) {
$limit[$i] = $i . ' ' . t('results');
}
$form['search_autocomplete_setting']['search_autocomplete_limit'] = array(
'#type' => 'select',
'#title' => t('Limit of the autocomplete search result'),
'#default_value' => variable_get('search_autocomplete_limit', 15),
'#options' => $limit,
'#multiple' => FALSE,
'#required' => TRUE,
);
$form['search_autocomplete_setting_test'] = array(
'#type' => 'fieldset',
'#title' => t('Test field'),
'#description' => t('In this field, you can check the appearence of an autocomplete search field.'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['search_autocomplete_setting_test']['search_autocomplete_test'] = array(
'#type' => 'textfield',
'#title' => t('Search autocomplete test field'),
'#size' => 40,
'#maxlength' => 40,
'#default_value' => '',
'#description' => t("Enter a keyword and wait for the result."),
'#autocomplete_path' => 'search_autocomplete/autocomplete',
'#required' => FALSE,
);
return system_settings_form($form);
}