You are here

function biblio_search_form_submit in Bibliography Module 6.2

Same name and namespace in other branches
  1. 6 biblio.pages.inc \biblio_search_form_submit()
  2. 7 includes/biblio.pages.inc \biblio_search_form_submit()
  3. 7.2 includes/biblio.pages.inc \biblio_search_form_submit()

Form submission handler for biblio_search_form().

When we submit a search, we revoke all current filters since search and filtering are considered two different concepts things conceptually.

But we store the results as a filter (which is just a list of node ids that matched the search request) so that we can reorder or export the search results like with any other filter. The filter has three components: ('search', <list of node ids>, <search keywords>). The second component (the filter value) is empty when submitting keywords. In biblio_db_search, we fill the second component with the list of nids matching our keywords, as returned by node_search. We store the keywords only for showing them in "Search results for <keywords>".

@informs

File

includes/biblio.pages.inc, line 953
Functions in the biblio module related to filtering and page generation.

Code

function biblio_search_form_submit($form, &$form_state) {
  $keys = $form_state['values']['keys'];
  if ($keys != '') {
    $_SESSION['biblio_filter'] = array(
      array(
        'search',
        '',
        $keys,
      ),
    );
    $base = variable_get('biblio_base', 'biblio');
    $form_state['redirect'] = $base;
  }
  else {

    // No keywords. Remove former search keys if any. Leaves other filters intact.
    if (_get_biblio_search_filter()) {
      $_SESSION['biblio_filter'] = array();
    }
  }
}