You are here

function finder_views_views_query_alter in Finder 6

Same name and namespace in other branches
  1. 7 modules/finder_views/finder_views.module \finder_views_views_query_alter()

Implementation of hook_views_query_alter().

See also

hook_views_query_alter()

File

modules/finder_views/finder_views.module, line 528
The finder views module.

Code

function finder_views_views_query_alter($view, &$query) {
  if (isset($view->finder_ids)) {
    if (!empty($view->finder_ids)) {
      $alias = $query
        ->ensure_table($view->base_table);
      $query
        ->add_where(NULL, $alias . '.' . $view->base_field . ' IN (' . db_placeholders($view->finder_ids) . ')', $view->finder_ids);
    }
    else {
      $query
        ->add_where(NULL, '1=0');
    }
  }
}