function apachesolr_search_page_settings_form_submit in Apache Solr Search 7
Same name and namespace in other branches
- 8 apachesolr_search.admin.inc \apachesolr_search_page_settings_form_submit()
- 6.3 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 492 - 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);
// Menu rebuild needed to pick up search path.
if ($form_state['values']['search_page']['search_path'] != $search_page['search_path']) {
variable_set('menu_rebuild_needed', TRUE);
}
// 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'],
)));
if (isset($form_state['clicked_button']['#redirect'])) {
$form_state['redirect'] = $form_state['clicked_button']['#redirect'];
}
else {
$form_state['redirect'] = current_path();
}
// Regardlessly of the destination parameter we want to go to another page
unset($_GET['destination']);
drupal_static_reset('drupal_get_destination');
drupal_get_destination();
}