Commit 7a4a8097 authored by Huang jie's avatar Huang jie Committed by zhou xiukun
Browse files

Issue #2684817 by Jieyyal: Won't work with https sites!

parent 3ce80eb5
Loading
Loading
Loading
Loading
+2 −1
Changes for baidu_map_geofield/baidu_map_geofield.module: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -140,11 +140,12 @@ function baidu_map_geofield_field_formatter_view($entity_type, $entity, $field,
      );

      // Attach JS settings and HTML markup to the field for rendering.
      $ssl_on = isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) === 'on') ? '&s=1' : '';
      $element[0] = array(
        '#attached' => array(
          'js' => array(
            // Supports Baidu Map JS API V2.
            ('//api.map.baidu.com/api?v=2.0&ak=' . $api_key) => array('type' => 'external'),
            ('//api.map.baidu.com/api?v=2.0&ak=' . $api_key . $ssl_on) => array('type' => 'external'),
            drupal_get_path('module', 'baidu_map_geofield') . '/js/GeoJSON.js' => array('type' => 'file'),
            drupal_get_path('module', 'baidu_map_geofield') . '/js/baidu_map_geofield.js' => array('type' => 'file'),
            array('data' => array('geofieldBaiduMap' => $js_settings), 'type' => 'setting'),
+2 −1
Changes for baidu_map_geofield/includes/baidu_map_geofield_plugin_style_map.inc: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -159,7 +159,8 @@ class baidu_map_geofield_plugin_style_map extends views_plugin_style {
      }

      // Supports Baidu Map JS API V2. At this stage, Baidu API key is defined.
      drupal_add_js('//api.map.baidu.com/api?v=2.0&ak=' . $api_key, 'external');
      $ssl_on = isset($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) === 'on') ? '&s=1' : '';
      drupal_add_js('//api.map.baidu.com/api?v=2.0&ak=' . $api_key . $ssl_on, 'external');
      drupal_add_js(drupal_get_path('module', 'baidu_map_geofield') . '/js/GeoJSON.js');
      drupal_add_js(drupal_get_path('module', 'baidu_map_geofield') . '/js/baidu_map_geofield.js');
      drupal_add_css(drupal_get_path('module', 'baidu_map_geofield') . '/css/baidu_map_geofield.css');