You are here

function ip_geoloc_js_info in IP Geolocation Views & Maps 8

Same name and namespace in other branches
  1. 7 ip_geoloc.module \ip_geoloc_js_info()

Implements hook_js_info().

File

./ip_geoloc.module, line 184
IPGV&M is a mapping engine for Views that contain locations of entities and/or visitors. Google Maps, Leaflet and OpenLayers2 maps are all supported and available through this module. Using a number of optional sources IPGV&M also retrieves…

Code

function ip_geoloc_js_info() {

  // With the js.module installed, and the .htaccess file edited to route
  // through js.php, this array defines what function to call when a POST is
  // received on "js/ip_geoloc/current_location".
  // We're calling the same function as defined in ip_geoloc_menu(), but using
  // a faster, more economic bootstrap phase, without hook_init().
  $dependencies = \Drupal::moduleHandler()
    ->moduleExists('session_cache_file') ? [
    'session_cache',
    'session_cache_file',
  ] : (\Drupal::moduleHandler()
    ->moduleExists('session_cache') ? [
    'session_cache',
  ] : []);
  $js_info = [
    'current_location' => [
      'bootstrap' => \Drupal::moduleHandler()
        ->moduleExists('better_statistics') ? DRUPAL_BOOTSTRAP_FULL : DRUPAL_BOOTSTRAP_SESSION,
      'callback function' => 'ip_geoloc_current_location_ajax_recipient',
      'dependencies' => $dependencies,
      'skip init' => TRUE,
      'token' => FALSE,
    ],
  ];
  return $js_info;
}