Commit a2368a42 authored by Italo Mairo's avatar Italo Mairo Committed by Italo Mairo
Browse files

Issue #3106074 by itamair: [Widget] Call loadGoogle() JS based on it's configuration

parent 734f5298
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -23,11 +23,20 @@
          // Set the map_data[mapid] settings.
          Drupal.geoFieldMap.map_data[mapid] = options;

          // Google maps library shouldn't be requested if the following
          // conditions apply:
          // - leaflet js is the chosen map library;
          // - geocoder integration is enabled;
          if (options.map_library === 'leaflet' && options.gmap_geocoder) {
            Drupal.geoFieldMap.map_initialize(options);
          }
          else {
            // Load before the Gmap Library, if needed, then initialize the Map.
            Drupal.geoFieldMap.loadGoogle(mapid, options.gmap_api_key, function () {
              Drupal.geoFieldMap.map_initialize(options);
            });
          }
        }
      });

    }