templates/pages/partials/google_api.html.twig line 1

Open in your IDE?
  1. {% set google_maps_key = (config_setting('site_google_api_key')|default('')|trim) ?: (google_maps_api_key_env|default('')|trim) %}
  2. {% if google_maps_key %}
  3.     <script async src="https://maps.googleapis.com/maps/api/js?key={{ google_maps_key }}&libraries=places&callback=googleLoaded"
  4.             data-cookieconsent="ignore"></script>
  5.     <script type="application/javascript">
  6.         window.isGoogleLoaded = false;
  7.         function googleLoaded() {
  8.             window.isGoogleLoaded = true;
  9.             const event = new Event('google:loaded');
  10.             document.dispatchEvent(event);
  11.         }
  12.     </script>
  13. {% endif %}