function apachesolr_search_custom_page_search_form_submit in Apache Solr Search 7
Same name and namespace in other branches
- 8 apachesolr_search.pages.inc \apachesolr_search_custom_page_search_form_submit()
- 6.3 apachesolr_search.pages.inc \apachesolr_search_custom_page_search_form_submit()
Processes apachesolr_search_custom_page_search_form submissions.
File
- ./
apachesolr_search.pages.inc, line 95 - Provides the page callback for user defined search pages.
Code
function apachesolr_search_custom_page_search_form_submit(&$form, &$form_state) {
$search_page = $form['#search_page'];
$redirect = $search_page['search_path'];
// Also encode slashes so we don't get akward situations when obtaining the
// search key. We can't use drupal_encode_path because for "aestetic" reasons
// they don't encode slashes...
$redirect_value = rawurlencode($form_state['values']['keys']);
if (strlen($form_state['values']['keys'])) {
$redirect .= '/' . $redirect_value;
}
$get = array();
if (isset($form_state['values']['get'])) {
$get = json_decode($form_state['values']['get'], TRUE);
}
if (!empty($form_state['values']['retain-filters'])) {
// Add our saved values
$get['retain-filters'] = '1';
}
else {
// Remove all filters
if (!empty($search_page['settings']['apachesolr_search_allow_user_input'])) {
unset($get['fq']);
}
if (module_exists('facetapi')) {
unset($get['f']);
}
}
// Add the query values into the redirect.
$form_state['redirect'] = array(
$redirect,
array(
'query' => $get,
),
);
}