You are here

function gmap_views_query_alter in GMap Module 5

Implementation of hook_views_query_alter(). We need to add in the node type so we can determine markers.

File

./gmap_views.module, line 246
GMap Views: A Views Style plugin providing a GMap view.

Code

function gmap_views_query_alter(&$query, &$view, $summary, $level) {
  if ($view->page && $view->page_type == 'gmap' || $view->block && $view->block_type == 'gmap') {
    $query
      ->add_field('type', 'node', 'gmap_node_type');
    if (module_exists('gmap_taxonomy')) {
      $query
        ->ensure_table('gmap_taxonomy_node');
      $query
        ->add_field('marker', 'gmap_taxonomy_node', 'gmap_taxonomy_marker');
    }
  }
}