simple-gmap-output.html.twig in Simple Google Maps 8
Same filename and directory in other branches
Displays the Simple Google Maps formatter.
Available variables:
- include_map: TRUE if an embedded map should be displayed.
- include_static_map: TRUE if an embedded static map should be displayed.
- width: Width of map.
- height: Height of map.
- static_scale: For use with retinal displays. Can double the width and height of static map ( possible values 1 or 2 )
- include_link: TRUE if a link to a map should be displayed.
- link_text: Text of link to display.
- url_suffix: Suffix of URLs to send to Google Maps for embedded and linked maps. Contains the URL-encoded address.
- zoom: Zoom level for embedded and linked maps.
- address_text: Address text to display (empty if it should not be displayed).
- map_type: Type of map to use (Google code, such as 'm' or 't').
- langcode: Two-letter language code to use.
- static_map_type: Type of map to use for static map (Google code, such as 'roadmap' or 'satellite')
- apikey: Google Maps API key (used for static maps only).
- title: A title attribute for the iframe
1 theme call to simple-gmap-output.html.twig
- SimpleGMapFormatter::viewElements in src/
Plugin/ Field/ FieldFormatter/ SimpleGMapFormatter.php - Builds a renderable array for a field value.
File
templates/simple-gmap-output.html.twigView source
- {#
- /**
- * @file
- * Displays the Simple Google Maps formatter.
- *
- * Available variables:
- * - include_map: TRUE if an embedded map should be displayed.
- * - include_static_map: TRUE if an embedded static map should be displayed.
- * - width: Width of map.
- * - height: Height of map.
- * - static_scale: For use with retinal displays. Can double the width and
- * height of static map ( possible values 1 or 2 )
- * - include_link: TRUE if a link to a map should be displayed.
- * - link_text: Text of link to display.
- * - url_suffix: Suffix of URLs to send to Google Maps for embedded and linked
- * maps. Contains the URL-encoded address.
- * - zoom: Zoom level for embedded and linked maps.
- * - address_text: Address text to display (empty if it should not be
- * displayed).
- * - map_type: Type of map to use (Google code, such as 'm' or 't').
- * - langcode: Two-letter language code to use.
- * - static_map_type: Type of map to use for static map (Google code, such as
- * 'roadmap' or 'satellite')
- * - apikey: Google Maps API key (used for static maps only).
- * - title: A title attribute for the iframe
- *
- * @ingroup themeable
- */
- #}
- {% if include_map %}
- <iframe width="{{ width }}" height="{{ height }}" title="{{ iframe_title }}" frameborder="0" style="border:0" src="https://maps.google.com/maps?hl={{ langcode }}&q={{ url_suffix }}&t={{ map_type }}&z={{ zoom }}&output=embed"></iframe>
- {% endif %}
- {% if include_static_map %}
- <div class="simple-gmap-static-map">
- <img src="https://maps.googleapis.com/maps/api/staticmap?size={{ width }}x{{ height }}&scale={{ static_scale }}&zoom={{ zoom }}&language={{ langcode }}&maptype={{ static_map_type }}&markers=color:red|{{ url_suffix }}&sensor=false&key={{ apikey }}" />
- </div>
- {% endif %}
- {% if include_link %}
- <p class="simple-gmap-link"><a href="https://maps.google.com/maps?q={{ url_suffix }}&hl={{ langcode }}&t={{ map_type }}&z={{ zoom }}" target="_blank">{{ link_text }}</a></p>
- {% endif %}
- {% if address_text is not empty %}
- <p class="simple-gmap-address">{{ address_text }}</p>
- {% endif %}