function apachesolr_search_page_settings_form_submit in Apache Solr Search 6.3
Same name and namespace in other branches
- 8 apachesolr_search.admin.inc \apachesolr_search_page_settings_form_submit()
- 7 apachesolr_search.admin.inc \apachesolr_search_page_settings_form_submit()
Processes apachesolr_search_page_settings_form form submissions.
1 string reference to 'apachesolr_search_page_settings_form_submit'
- apachesolr_search_page_settings_form in ./
apachesolr_search.admin.inc - Menu callback/form-builder for the form to create or edit a search page.
File
- ./
apachesolr_search.admin.inc, line 532 - Administrative settings for searching.
Code
function apachesolr_search_page_settings_form_submit($form, &$form_state) {
$settings = array();
$settings['fq'] = array();
if ($form_state['values']['filters']) {
foreach (explode(',', $form_state['values']['filters']) as $string) {
$string = trim($string);
// Minimal validation. ':' must exist and can't be the 1st char..
if (strpos($string, ':')) {
$settings['fq'][] = $string;
}
}
}
$settings['apachesolr_search_custom_enable'] = $form_state['values']['custom_filter_enable'];
$settings['apachesolr_search_search_type'] = $form_state['values']['search_type'];
// Add all advanced settings.
$settings += $form_state['values']['advanced'];
// Set the default search page settings
if (!empty($form_state['values']['make_default']) && isset($form_state['values']['page_id'])) {
variable_set('apachesolr_search_default_search_page', $form_state['values']['page_id']);
}
$search_page = array();
$search_page['page_id'] = $form_state['values']['page_id'];
$search_page['label'] = $form_state['values']['label'];
$search_page['description'] = $form_state['values']['description'];
$search_page['env_id'] = $form_state['values']['env_id'];
$search_page['search_path'] = $form_state['values']['search_path'];
$search_page['page_title'] = $form_state['values']['page_title'];
$search_page['settings'] = $settings;
apachesolr_search_page_save($search_page);
// Saves our values in the database, sets redirect path on success.
drupal_set_message(t('The configuration options have been saved for %page.', array(
'%page' => $form_state['values']['label'],
)));
// for some reason $_GET was not sufficient.
if (isset($_REQUEST['destination'])) {
unset($_REQUEST['destination']);
}
if (isset($form_state['clicked_button']['#redirect'])) {
$form_state['redirect'] = array(
$form_state['clicked_button']['#redirect'],
);
}
else {
$form_state['redirect'] = array(
$_GET['q'],
);
}
// Menu rebuild needed to pick up search path.
menu_cache_clear_all();
menu_rebuild();
}