function facetapi_search_form_submit in Facet API 6
Processes search_form form submissions.
1 string reference to 'facetapi_search_form_submit'
- facetapi_form_search_form_alter in ./
facetapi.module - Implementation of hook_form_FORM_ID_alter().
File
- ./
facetapi.module, line 1406 - An abstracted facet API that can be used by various search backens.
Code
function facetapi_search_form_submit($form, &$form_state) {
if ($adapter = facetapi_adapter_load($form['module']['#value'])) {
$qstring = array();
if (!empty($form_state['values']['processed_facets'])) {
foreach ($form_state['values']['processed_facets'] as $facet) {
foreach ($facet['values'] as $value) {
if ('__all__' != $value) {
$qstring[$facet['field alias']][$value] = $value;
}
}
}
}
// Redirects to appropriate search page with facet information in the
// query string.
// @todo use adapter to get search keys.
$path = sprintf('search/%s/%s', $form['module']['#value'], facetapi_keys_encode(search_get_keys()));
if (!empty($qstring)) {
$form_state['redirect'] = array(
$path,
drupal_query_string_encode(array_map('array_values', $qstring), array(
'q',
'page',
)),
);
}
else {
$form_state['redirect'] = $path;
}
}
}