You are here

function gmap_views_pre_render in GMap Module 7

Same name and namespace in other branches
  1. 6.2 gmap.module \gmap_views_pre_render()
  2. 6 gmap.module \gmap_views_pre_render()
  3. 7.2 gmap.module \gmap_views_pre_render()

Implementation of hook_views_pre_render().

File

./gmap.module, line 1375
GMap -- Routines to use the Google Maps API in Drupal.

Code

function gmap_views_pre_render(&$view) {
  static $gmap_processed;

  // Add js only for gmap style views with ajax and not already processed.
  if ($view->plugin_name != 'gmap' && $view->plugin_name != 'gmapextended' || !$view->use_ajax || $gmap_processed) {
    return;
  }

  // Mark the view as already processed.
  $gmap_processed = TRUE;

  // Add js with new views callback.
  drupal_add_js(drupal_get_path('module', 'gmap') . '/js/gmap_views_ajax.js', array(
    'group' => JS_DEFAULT,
  ));
}