function finder_views_finder_result in Finder 7
Same name and namespace in other branches
- 6 modules/finder_views/finder_views.module \finder_views_finder_result()
Implements hook_finder_result().
See also
hook_finder_result()
File
- modules/
finder_views/ finder_views.module, line 487 - The finder views module.
Code
function finder_views_finder_result($finder, $keywords, $results, $form_state) {
$output = '';
if ($results || $finder->settings['views']['empty_text']) {
if ($finder->settings['views']['results']) {
$output .= theme('finder_views_results', array(
'results' => $results,
'finder' => $finder,
'form_state' => $form_state,
));
}
else {
$args = array();
$view = views_get_view($finder->settings['views']['view']);
$display_id = 'default';
if ($finder->settings['views']['displays']['output']) {
$display_id = $finder->settings['views']['displays']['output'];
}
$view
->set_display($display_id);
$view
->set_arguments($args);
$view->is_cacheable = FALSE;
$view->display_handler
->set_option('use_pager', 0);
// compile ids so that finder_views_views_query_alter() knows what to do
$ids = array();
foreach ($results as $result) {
$ids[] = $result->{$result->base_field};
}
$view->finder_ids = $ids;
$view
->preview();
$output .= $view
->render($display_id);
}
}
return $output;
}