You are here

function finder_search_preprocess_finder_results in Finder 7

Same name and namespace in other branches
  1. 6 modules/finder_search/finder_search.module \finder_search_preprocess_finder_results()

Intervene before theme function.

Kind of like a template preprocess, except not for a template.

See also

finder_search_theme_registry_alter()

1 string reference to 'finder_search_preprocess_finder_results'
finder_search_theme_registry_alter in modules/finder_search/finder_search.module
Implements hook_theme_registry_alter().

File

modules/finder_search/finder_search.module, line 82
The finder search module.

Code

function finder_search_preprocess_finder_results($variables) {
  extract($variables);
  global $theme_info;
  $theme_funcs = variable_get('finder_search_finder_results_theme', array());
  $theme_func = !empty($theme_funcs[$theme_info->name]) ? $theme_funcs[$theme_info->name] : 'theme_finder_results';
  if (isset($finder->settings['advanced']['search']) && $finder->settings['advanced']['search'] && empty($results)) {
    $keys = array();
    foreach ($keywords as $finder_element_id => $finder_element_keywords) {
      foreach ((array) $finder_element_keywords as $keyword) {
        $keys[] = $keyword;
      }
    }
    $results_array = finder_search_get_result(implode(' ', $keys), $finder->settings['advanced']['search_tab']);
    $results = theme('finder_search_results', array(
      'results' => $results_array,
      'finder' => $finder,
      'form_state' => $form_state,
      'no_results' => $no_results,
    ));

    // search module has it's own pager
    $pager = 0;
  }
  return $theme_func(array(
    'results' => $results,
    'finder' => $finder,
    'keywords' => $keywords,
    'pager' => $pager,
    'params' => $params,
    'form_state' => $form_state,
    'no_results' => $no_results,
  ));
}