You are here

public function GoogleMapsDisplayTrait::getGoogleMapsApiUrl in Geolocation Field 8

Return the fully build URL to load Google Maps API.

Return value

string Google Maps API URL

6 calls to GoogleMapsDisplayTrait::getGoogleMapsApiUrl()
CommonMap::render in src/Plugin/views/style/CommonMap.php
Render the display in this style.
GeolocationGooglegeocoderWidget::formElement in src/Plugin/Field/FieldWidget/GeolocationGooglegeocoderWidget.php
Returns the form for a single field widget.
GeolocationGoogleMap::preRenderGoogleMapElement in src/Element/GeolocationGoogleMap.php
Map element.
GeolocationGoogleMapFormatter::viewElements in src/Plugin/Field/FieldFormatter/GeolocationGoogleMapFormatter.php
Builds a renderable array for a field value.
GoogleGeocodingAPI::formAttachGeocoder in src/Plugin/geolocation/Geocoder/GoogleGeocodingAPI.php
Attach geocoding logic to input element.

... See full list

File

src/GoogleMapsDisplayTrait.php, line 102

Class

GoogleMapsDisplayTrait
Class GoogleMapsDisplayTrait.

Namespace

Drupal\geolocation

Code

public function getGoogleMapsApiUrl() {
  $parameters = [];
  foreach ($this
    ->getGoogleMapsApiParameters() as $parameter => $value) {
    $parameters[$parameter] = is_array($value) ? implode(',', $value) : $value;
  }
  $url = Url::fromUri(static::$GOOGLEMAPSAPIURL, [
    'query' => $parameters,
    'https' => TRUE,
  ]);
  return $url
    ->toString();
}