function search_log_admin_settings in Search Log 7
Same name and namespace in other branches
- 6 search_log.admin.inc \search_log_admin_settings()
Display admin settings.
Return value
array of form content.
1 string reference to 'search_log_admin_settings'
- search_log_menu in ./
search_log.module - Implements hook_menu().
File
- ./
search_log.admin.inc, line 14 - Admin page callbacks file for the search_log module.
Code
function search_log_admin_settings($form, &$form_state) {
$form = array();
$form['logging'] = array(
'#type' => 'fieldset',
'#title' => t('Search log settings'),
);
$terms_options = array(
SEARCH_LOG_TERMS_LOWERCASE => t('lowercase (%1 stored as %2)', array(
'%1' => 'Apple iPod',
'%2' => 'apple ipod',
)),
SEARCH_LOG_TERMS_UPPERCASE_FIRST => t('uppercase first word (%1 stored as %2)', array(
'%1' => 'Apple iPod',
'%2' => 'Apple ipod',
)),
SEARCH_LOG_TERMS_UPPERCASE_WORDS => t('uppercase all words (%1 stored as %2)', array(
'%1' => 'Apple iPod',
'%2' => 'Apple Ipod',
)),
);
$form['logging']['search_log_terms'] = array(
'#type' => 'radios',
'#title' => t('Search term normalization'),
'#description' => t('Search terms are normalized before they are stored in Search log. Changing this value may result in duplicate terms for the current day.'),
'#options' => $terms_options,
'#default_value' => variable_get('search_log_terms', SEARCH_LOG_TERMS_LOWERCASE),
);
foreach (module_implements('search_info') as $module) {
$module_options[$module] = $module;
}
$form['logging']['search_log_modules_enabled'] = array(
'#type' => 'checkboxes',
'#title' => t('Modules'),
'#description' => t('Select modules to record in Search log. If no modules are checked, all modules which implement !hook_search_info() will be recorded.', array(
'!hook_search_info()' => l('hook_search_info()', 'http://api.drupal.org/api/drupal/modules--search--search.api.php/function/hook_search_info/7'),
)),
'#options' => $module_options,
'#default_value' => variable_get('search_log_modules_enabled', array()),
);
$form['logging']['search_log_preprocess'] = array(
'#type' => 'checkbox',
'#title' => t('!warning Collect search result with preprocess_search_results()', array(
'!warning' => '<span class="error">[Experimental]</span>',
)),
'#description' => t('Search does not have a hook to obtain the number of search results. This theme function will work in certain circumstances. If enabled, the function will add one extra DB write for failed search results.'),
'#default_value' => variable_get('search_log_preprocess', TRUE),
);
$form['status'] = array(
'#type' => 'fieldset',
'#title' => t('Search log status'),
);
$count = db_query('SELECT COUNT(qid) FROM {search_log}')
->fetchField();
$form['status']['search_log_count']['#markup'] = '<p>' . t('There are %count entries in the Search log table. !clear', array(
'%count' => number_format($count),
'!clear' => l(t('Clear log'), 'admin/config/search/search_log/clear'),
)) . '</p>';
$form['status']['search_log_cron'] = array(
'#type' => 'textfield',
'#title' => t('Days to keep search log'),
'#description' => t('Search log table can be automatically truncated by cron. Set to 0 to never truncate Search log table.'),
'#size' => 4,
'#default_value' => variable_get('search_log_cron', 0),
);
$form['#validate'][] = 'search_log_admin_settings_validate';
return system_settings_form($form);
}