You are here

function theme_fuzzysearch_show_results in Fuzzy Search 6

Theme hook for rendering search results.

2 theme calls to theme_fuzzysearch_show_results()
fuzzysearch_block in ./fuzzysearch.module
Implementation of hook_block().
fuzzysearch_show_results in ./fuzzysearch.module
Gather results from the index and build result page.

File

./fuzzysearch.module, line 958
Module file for fuzzysearch module.

Code

function theme_fuzzysearch_show_results($keys = '', $theme = NODE_THEME, $limit = 10) {
  drupal_add_css(drupal_get_path('module', 'fuzzysearch') . '/fuzzysearch.css', 'module');
  $results = fuzzysearch_process($keys, $theme, $limit);
  if ($results) {
    if ($theme == NODE_THEME) {
      drupal_set_title(check_plain($keys));
      $output = '<h2>' . t('Results for !keys', array(
        '!keys' => check_plain($keys),
      )) . '</h2>';
      $output .= '<div class="clear-block">';
      $output .= drupal_get_form('fuzzysearch_form', $keys);
      $output .= '</div>';
      $output .= theme('fuzzysearch_results', $results);
      $output .= theme('pager', NULL, $limit);
    }
    else {
      $output .= theme('fuzzysearch_results_title', $results);
    }
  }
  else {
    if ($keys != '') {
      $output = '<p>' . t('No matches were found.') . '</p>';
    }
    $output .= drupal_get_form('fuzzysearch_form', $keys);
  }
  return $output;
}